Reputation: 129
In my secnario I have maintaining within mainviewcontroller
one page viewcontroller
with 10 pages (viwcontrollers) and one tableviw
with multiple rows. Now If I swipe the pageviewcontroller (top box) I can get page Index. Same time underthe table row If I select I need to get page view controller Index
value.
Upvotes: 0
Views: 511
Reputation: 77
Because not having the enough reputation to comment , i am putting my view in answer. @Sanju you are getting index of PageViewController . you only need to print that index when selecting TableViewCell.
just save that index value somewhere. i suggest to save in NSUserDefaults and you can use your index value anywhere in your project. go through this Link
Upvotes: 1
Reputation: 438
didSelectRowAtIndexPath:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"pageView" sender:self];
}
Create a prepareforSegueMethod to send the details
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
pageViewController *sendDetails = segue.destinationViewController;
if ([[segue identifier] isEqualToString:@"viewDetail"])
{
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSInteger row = indexPath.row;
sendDetails.selectedRow = row;
}
}
now u can use the selectedRow property to get the value
so whenever u click the cell u will be directed to the next page along with index number...
Upvotes: 0