tags:

views:

23

answers:

2

there is two views first one have a button i want to show the tiltle of the button on the second view ?how can i do it?

A: 

one way is to store it in application delegate's variable. I don;t know whether it belongs to best practices or not.

or you can create a object of second view from first while adding it as a subview and can set variable in second view's variable.

like

if(self.view2ViewController == nil) {
View2ViewController *view2 = [[View2ViewController alloc] initWithNibName:@”View2″ bundle:[NSBundle mainBundle]];
view2.passedString = self.myName;
self.view2ViewController = view2;
[view2 release];
}

here is the complete code with explanation

org.life.java
A: 

you can make object of second view and can pass string to it

view2object.view2string=@"anything" or label.text;

pankaj kainthla