Like split on ipad, TableView control on the left shows different views on the right
recently to do a project, the project is running on the ipad, need to place the page horizontally, first of all, to record how to let the program run after the page landscape, I set up a base Class View controller, the bottom is called the base page.
This controller, fill in a piece of this code, all the pages are inherited from this view controller, play all the pages are horizontal display
#pragma mark-
#pragma mark- inherits from this class so that the page will automatically traverse the screen
-(BOOL) shouldautorotatetointerfaceorientation: (uiinterfaceorientation) tointerfaceorientation {
return (tointerfaceorientation = =uiinterfaceorientationlandscaperight) | | (Tointerfaceorientation = = Uiinterfaceorientationlandscapeleft);
}
to achieve this, I initially planned to place the view on the right side of the page, rather than Viewcontroller. Because the view controller automatically creates a full-screen view, it does not succeed. But a project is built with a view, it is inevitable to feel inappropriate, afraid to dig a hole for themselves, become more digging deeper, and finally they are not buried. However, there is no way ah, the project urged the tight, so, or take a view to do a bit. found that actually the view can achieve this effect, but my heart always feel not practical. So, in a variety of development groups, there are some people know a variety of questions. Finally, there is a great God to give me a correct guidance, it seems that his understanding of something is not deep enough, hereby record
Continue to constrain the base page so that all pages are on the left side of the page, add the code below
-(void) loadview{
//[Super Loadview]; idea not to call here, or create a full-screen view
UIView *view = [UIViewCreateView];
View. frame =CGRectMake(295/2.f,up, kscreenwidth -295/ 2.f, kscreenheight - up);
Self. View = CustomView;
}
It turns out that every time you call [Super Loadview], so just create a full-screen view, so we do not call this, we create a view, to achieve the size of the view you want to create, the effect is
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Like split on ipad, TableView control on the left shows different views on the right