Rushang Prajapati
Rushang Prajapati

Reputation: 596

Push next view Pagemenu ios xcode

Hello I am using Page menu in application and i want to push from didSelectRowAtIndexPath in next view in one view which is involed in page menu image

i know all way which we use for push and model.if i am using model with custom navigation bar then page menu hide on dismiss model.

Upvotes: 0

Views: 426

Answers (2)

Devang Goswami
Devang Goswami

Reputation: 284

One can not push the viewcontroller in pageView , PageviewController don't have navigation controller .

Solution :

There are two ways to make this possible suggested by Nitin Gohel

  1. set notification for event and Retrieve the notification on main Controller

You can send the information in Notification required in another viewController.

NSDictionary* userInfo = @{@"abc": @"aaa"};

NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName:@"One" object:self userInfo:userInfo];

In MainViewController just set the onserver for that notification in viewDidLoad method

- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(OneNoti:) name:@"One" object:nil];
}

And perform push from MainViewController:

-(void) OneNoti:(NSNotification*)notification
{
NSDictionary* userInfo = notification.userInfo;
    NSNumber* total = (NSNumber*)userInfo[@"total"];
    NSLog (@"Successfully received test notification! %i", total.intValue);
NSLog(@"%@",notification.userInfo);
[self performSegueWithIdentifier:@"1_" sender:nil];
}
  1. Set the delegate methods in MainView Controller and call the methods while performing action from page view and push from that Action .

Same like above way .

Upvotes: 0

nikhil84
nikhil84

Reputation: 3207

Assumed hierarchy:

UINavigation Controller -- UIViewController -- UIPageController

UIPageController (with 2 UIViewController) -- UITableViewController-1 and UITableViewController-2

On didSelectRowAtIndexPath method

UIPageController -- UITableViewController-1 //Selected any one row

Then just push the next view controller onto the current UITableViewController.

Note - Both controller in UIPageController maintain separate life cycle that is independent from each other.

Upvotes: 1

Related Questions