I am doing like below. The idea is to pass different values and display data based on type supplied from the menu button.
But it is not working as it should. It is just displaying which ever view is called first (or data is not refreshed on second button press shows the first view). So what is the correct way of doing it?
if (indexPath.row == 1) {
SomeViewController* v = [self.storyboard instantiateViewControllerWithIdentifier:@"storyboardCat"];
v.type=@"1";
[self showViewController:v];
[self.slidingViewController resetTopViewAnimated:YES];
}
if (indexPath.row == 2) {
SomeViewController* v = [self.storyboard instantiateViewControllerWithIdentifier:@"storyboardCat"];
v.type=@"2";
[self showViewController:v];
[self.slidingViewController resetTopViewAnimated:YES];
}
Edit -for more information SomeViewController.h file
@interface SomeViewController : UIViewController
@property (nonatomic, strong) NSString *type;
@end
SomeViewController.m file
@implementation SomeViewController
@synthesize type;
arrayData = [NSMutableArray arrayWithArray:[CoreDataController getSomeData:type]];
//so trying to populate different values in tableview based on passed parameter to function
But now which ever view is called first or value is passed (either 1 or 2), only those values is populated and values does not change on simultaneous call passing another value(for eg when index row is 2).
Try this
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil]; //Change Main if your storyboard name is different.
SomeViewController* v = [storyboard instantiateViewControllerWithIdentifier:@"launchView"]; // launchView is the name given to the view controller in the properties as shown in below screenshot
Hope this helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.