Reputation: 353
I am developing an Apple Watch App which shows the Events Info. according to Location.I have implemented Page-based Navigation for displaying The Event List.On First Time,The Event List contains 10 Events.Now,I want to display the User Next or Previous 10 Events info.(i.e. generating Pages and adding those pages dynamically to current Page List) as the User swipes right of the First Page or left of the Last Page of The Current Event List. Is it possible to do so ? If Yes,then Plz let me know the ways to do so.
Upvotes: 2
Views: 308
Reputation: 81
You can update the previously presented list of pages using
[WKInterfaceController reloadRootControllersWithNames:controllers contexts:contexts];
For example:
NSArray *controllers = @[@"mainController", @"mainController", @"mainController"];
NSArray *contexts = @[@"Context1", @"Context2"];
[WKInterfaceController reloadRootControllersWithNames:controllers contexts:contexts];
Make sure to call this from the init
method of your initial WKInterfaceController.
Upvotes: 2
Reputation: 652
Yes. We can add the pages in watchkit dynamically. I have done using this code.
// Total pages to display
NSArray *controllerNames=[NSArray arrayWithObjects:@"PageInterfaceController1",@"PageInterfaceController2",@"PageInterfaceController3",@"PageInterfaceController4", nil];
//Content to be passed the pages using context
NSArray *contexts=[NSArray arrayWithObjects:@"1",@"2",@"3",@"4", nil];
[self presentControllerWithNames:controllerNames contexts:contexts];
Upvotes: 2