I have a view with a UIView and a button. Pressing the button brings up a ModalViewController which is UIView with UITextField in it. I need to pass the string value of NSObject in the UIView to the ModalViewController as a string. On button click I call this:
-(void) editNote{
TextViewController * vc = [(TextViewController *)[TextViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
[self.navigationController presentModalViewController:nav animated:YES];
[vc release];
}
Normally, on row select we push the data using pushviewcontro开发者_如何学JAVAller to the next view but after doing lot of google I cannot figure out how to pass the data using presentmodalviewcontroller.
You could add a property to TextViewController, then just use vc.object = myObject
. Or you could make a new init
method that takes some more information.
精彩评论