jeudi 29 janvier 2015

Let controller handle segue from UIScrollView table didSelectRowAtIndexPath

my current "layer" path looks like this:



UITabBarController
`-- UINavigationController
`-- UIViewController
`-- UIScrollView
`-- UIView
`-- UITableView
`-- UITableViewController


I have the didSelectRowAtIndexPath listener on the UITableViewController, but since this is programatically added and doesn't actually exist in the storyboard there are no push segue's to handle the interaction. I was wondering how I could pass this "up the chain" to my UIViewController?


Thanks - the code in the UIViewController which creates the UIScrollView looks like this:



CGRect frame = _scrollView.bounds;
float width = _scrollView.bounds.size.width;
float height = _scrollView.bounds.size.height;

[_scrollView setDelegate:self];
[_scrollView setContentSize:CGSizeMake(width * 3, height)];
[_scrollView setPagingEnabled:YES];

UIView * viewItem = [[UIView alloc] initWithFrame:frame]; frame = CGRectOffset(frame, width, 0);
UITableView * tableItem = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
self setConItem:[[UITableViewControllerItem alloc] init]];

[_conItem load:@"item" withTable:tableItem];

tableItem.dataSource = _conItem;
tableItem.delegate = _conItem;

[viewItem addSubview:tableItem];

[_scrollView addSubview:viewItem];



Aucun commentaire:

Enregistrer un commentaire