Transferring Strings Between Views


I am having problems transferring a string from one iOS View to another.

If I have a textfield in View1 called txtName and I want to make it the Title of View2, I thought all I would have to do is write this code.


But that does not work.

Or if I want to have this code:


That does not work either.

I get the error:

Static reference to instance method: call this on an instance of class View1.

I don’t know what the heck that means.

Any guidance would be appreciated.



It looks like you are not addressing instances of your views but the view templates themselves. In order to pushto view2 you need to create an instance before with new – what does the compiler say when you are addressing this one?
Edit: Or, in your case, rather view1.
As an example: Try something like (untested)

Dim V2 as new View2 V2.Title = self.title self.pushto V2

Thank you so much Ulrich. That worked great. I really appreciate that you took the time to help me.

Thanks again.

I’m glad to read that, and you’re very welcome, James.