ios - Starting a View Controller from a "nested" View Controller -


i have uiviewcontroller has uiviewcontroller added subview:

#import "listviewcontroller.h"  @interface searchviewcontroller ()  @end  @synthesize listcontroller;  - (void)viewdidload {     [super viewdidload];      …      self.listcontroller =[[listviewcontroller alloc] init];     [self.view insertsubview:listcontroller.view belowsubview:maintabbar];     self.listcontroller.view.frame = cgrectmake(0, tabheight, screenwidth, (screenheight-tabheight));  } @end 

the listviewcontroller has tableview in it. on click of item in tableview, want add uiviewcontroller navigation controller:

#import “placeviewcontroller.h"  @interface listviewcontroller ()  @end  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     placeviewcontroller *vc = [[placeviewcontroller alloc] init];     [self.navigationcontroller pushviewcontroller:vc animated:yes];      [tableview deselectrowatindexpath:indexpath animated:yes]; }  @end 

this works if listviewcontroller added navigation controller normally. but, in case, when listviewcontroller "nested" within another, newly added placeviewcontroller not opening. there way make work? thanks

you should create parent/child relation between container , controller has view added. informations can found in intro of https://developer.apple.com/library/ios/documentation/uikit/reference/uiviewcontroller_class/ , more on internet. @ custom container view controller.

then can navigationcontroller property of container listviewcontroller using parentviewcontroller property of listviewcontroller.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -