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.
Asked
Active
Viewed 506 times
0

Sanju
- 129
- 1
- 10
-
your question is not clear – Anbu.Karthik Jan 19 '16 at 11:10
-
ok your cell array count and pageview controller array count are same or different – Anbu.Karthik Jan 19 '16 at 11:15
-
I can't understand your question – Gregory Molette Jan 19 '16 at 11:15
-
your tableview array count is 10 or below or above' – Anbu.Karthik Jan 19 '16 at 11:16
-
exactly 10 only. @Anbu.Karthik – Sanju Jan 19 '16 at 11:18
-
then we can get this answer in assumption , just like if you select the tableview in 5 index you need to pass the 5th index to pageviewcontroller and refresh the current index thats all bro – Anbu.Karthik Jan 19 '16 at 11:21
-
No not like that. any tableviw row cell user If select I need to get curent Index of pageviewcontroller value and print somewhere. That It. No need navigate related cell Index that and all!@Anbu.Karthik – Sanju Jan 19 '16 at 11:22
2 Answers
1
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

Priyanta Singh
- 77
- 1
- 12
-
why to use NSUserDefaults when he can get the results by just passing the value?? as he only wants to display it and not save it. – Shravan Jan 19 '16 at 12:19
-
@Shravan his question is not clear. and as i mentioned that because of not having enough reputation i am posting my comment as answer. the far i understand his question,, is that he is getting the value and the only thing is to print. so i just told him the better way. – Priyanta Singh Jan 19 '16 at 12:44
0
- First import the pageViewController.h file in ur tableViewController
- Create a @property in pageViewController to store the selected row data
- then u need to do the following in ur
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...

Shravan
- 438
- 3
- 17
-
NO. My question is page viewontroller sperate under tableview cell If I select to get pageviewcontroller Index value. Thats it. – Sanju Jan 19 '16 at 11:17
-
1@Sharven -- your answer is different is not related to question please verify once and modify your answer once – Anbu.Karthik Jan 19 '16 at 11:23
-
the index path of each cell will be the pageControllerIndex in this case and u can set the starting viewController in pageview as this.... PageContentViewController *startingViewController = [self viewControllerAtIndex:selectedRow]; so whenever u go to next or previous pages using pageControlDelegate methods u can keep a track of it... and send it back to the tableViewController ur problem is solved..... – Shravan Jan 19 '16 at 11:28
-
@Anbu.Karthik His question wasnt clear and this is what he meant when he asked first... – Shravan Jan 19 '16 at 11:34
-
-
however instead of using performSegue he can just use the code inside perform segue to send the values and use it for his purpose.....it wil give the desired results... he needs to figure out himself i guess. the above code have enough concepts to do it – Shravan Jan 19 '16 at 11:42