Like split on ipad, TableView control on the left shows different views on the right

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.