ios - How to hide MasterViewController in UISplitViewController for iPad -
i working
uisplitviewcontroller
,where need hidemasterviewcontroller
1stdetailviewcontroller
. means,when app launches,themasterviewcontroller
must hidden without clicking onuibutton
. tried usinguisplitviewcontroller
insideuiviewcontrollers
.but nothing happened. after tried develop overall app withinuisplitviewcontroller
. here code tried hidemasterviewcontroller
masterviewcontroller = [splitviewcontroller.viewcontrollers objectatindex:0]; detailvc = [splitviewcontroller.viewcontrollers objectatindex:1]; [master.view setframe:cgrectmake(0, 0, 0, 0)]; detail.view.frame = splitviewcontroller.view.bounds;
i have spent 1 week doing this,but nothing worked.please provide solution.it great pleasure.
update:
ok done hiding master view controller.but when set delegate detail view controller,it hides master view controller view controllers. here appdelegate's code adding
uisplitviewcontroller
.
self.splitviewcontroller =[[uisplitviewcontroller alloc]init]; mastertableviewcontroller *masterviewcontroller=[[mastertableviewcontroller alloc]initwithnibname:@"mastertableviewcontroller" bundle:nil]; uinavigationcontroller *masternavigate=[[uinavigationcontroller alloc]initwithrootviewcontroller:masterviewcontroller]; detailviewcontroller *detailvc=[[detailviewcontroller alloc]initwithnibname:@"detailviewcontroller" bundle:nil]; uinavigationcontroller *detailnavigate=[[uinavigationcontroller alloc]initwithrootviewcontroller:detailvc]; self.splitviewcontroller.viewcontrollers=[nsarray arraywithobjects:masternavigate,detailnavigate, nil]; self.splitviewcontroller.delegate=detailvc; self.window.rootviewcontroller=self.splitviewcontroller;
here,i set delegate of splitviewcontroller detailvc.in detailviewcontroller nex mishra's code hiding master view controller , when navigate other views detailvc,it hides master view controller. know irritating,but helpful.
- (bool)splitviewcontroller:(uisplitviewcontroller*)svc shouldhideviewcontroller:(uiviewcontroller *)vc inorientation:(uiinterfaceorientation)orientation { // commant used showing or hiding split view controller svc.presentswithgesture = true; return yes; } // dont forget assign delegate in viewwillappear (self.splitviewcontroller.delegate = self;)
Comments
Post a Comment