When pushing a viewcontroller, how do I pass data long with it as well (such as "asdf":123)? Are you supposed to addObjects to a NSBundle?
MyViewController * myVC = [[MyViewController alloc] initWithNibName:nil bundle:nil];
myVC.someProperty = someValue; // Pass your data here
[self.navigationController pushViewController:myVC animated:YES];
And in your MyViewController
class :
.h
@interface MyViewController : UIViewController
@property (nonatomic, strong) NSString * someProperty;
@end
.m
@implementation MyViewController
- (void)viewDidLoad {
[super viewDidLoad];
// your data has been set
// self.someProperty is equal to "some value"
}
I don't believe you can, but of course you can add relevant properties or methods to your ViewController class and use these prior to pushing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With