I have a view with a textbox, pickerview and UIButton(working as radio buttons).
On click of submit UIButton, the user should be shown with the details entered by him on another view having a tableView. I am using navigationController to navigate on another view with tableview.
The navigation works fine but how do I display the data entered in view1 on view2 that too in tableview?
Following is my code:
.m
- (void) goToViewTwo
{
tableViewController *viewTwo = [[tableViewController alloc] initWithNibName:@"tableViewController" bundle:[NSBundle mainBundle]];
self.tabView = viewTwo;
[self.navigationController pushViewController:self.tabView animated:YES];
}
How do I assign the data to tabView?
edited to include .h of tableViwController
#import <UIKit/UIKit.h>
@interface tableViewController : UIViewController
@property(nonatomic,retain)NSString *name;
@property(nonatomic,retain)UILabel *lbl;
@property (strong, nonatomic) IBOutlet UILabel *textLabal;
@end
Just like you’re doing it, except before pushing the next view controller, set a property on it. For example, to show the text from viewOne on viewTwo, viewTwo will need a string property called (something like) textFromViewOne.
Now, in the second VC, it can contain UIControls to present the data stored in it’s properties. Continuing with the text example…