IOS---IPAD development and unique IPAD stunt

Source: Internet
Author: User

IOS---IPAD development and unique IPAD stunt
The biggest difference between iPad development and development is the adaptation of screen controls and horizontal and vertical screen rotation. The horizontal and vertical screen configuration of SizeClass In the Storyboard does not support iPad development. 1. In the controller, the orientation of the device to be rotated is iOS8 and later. The screen size can only be divided into the size of the screen after rotation, and is no longer an expired orientation. How to get the orientation of screen rotation in iOS7 and before

/** // UIInterfaceOrientation. The screen direction is UIInterfaceOrientationUnknown = unknown, UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, orientation = custom, orientation = custom, callback = required */-(void) willAn ImateRotationToInterfaceOrientation :( UIInterfaceOrientation) toInterfaceOrientation duration :( NSTimeInterval) duration {// NSLog (@ "% s", _ func _);}-(void) willRotateToInterfaceOrientation :( UIInterfaceOrientation) toInterfaceOrientation duration :( NSTimeInterval) duration {// NSLog to be rotated (@ "% s", _ func _);} After iOS8, there is only one screen, that is, when the screen is larger than the height of the horizontal screen, otherwise it is a vertical screen. IPad screen only (1024*768) horizontal screen (768*1024) portrait screen-(void) viewWillTransitionToSize :( CGSize) size withTransitionCoordinator :( id <UIViewControllerTransitionCoordinator>) coordinator {/1. determine whether it is a landscape BOOL isLandscape = size. width = 1024; // 2. set the width and height of the Dock // obtain the time when the screen rotation animation is executed CGFloat duration = [coordinator transitionDuration]; [UIView animateWithDuration: duration animations :^{}];}

 

2. in the iPad, Modal pop-up controller and style Modal are commonly used to display four style controller attributes: modalPresentationStyle UIModalPresentationFullScreen: Full Screen Display (default) UIModalPresentationPageSheet width: the width (768) of the portrait screen height: the height of the current screen (fill in the entire height) Landscape portrait screen UIModalPresentationFormSheet: occupies a small landscape portrait screen in the middle of the screen


UIModalPresentationCurrentContext: follows the presentation style of the parent controller. Modal has four types of transition style controller attributes: modalTransitionStyle UIModalTransitionStyleCoverVertical: drill up from the bottom (default) orientation: 3D flip complete: fade in and fade out complete: page flip (only show part, usage premise: the rendering style must be UIModalPresentationFullScreen) transition style pop style after iOS8 UIModalPresentationNone3. Use Cases of UIPopoverController specific to iPad: scenario ① Add the leftBarButtonItem button on the navigation bar, and then the content controller of UIPopoverController to create UIPopoverController controller is added to UIPopoverController. 1> set the content controller (and create a content controller first) it is emphasized that UIPopoverController does not inherit UIViewController and does not have the display function. To set the content, use consumer to set the content-(id) initWithContentViewController :( UIViewController *) viewController;-(void) setContentViewController :( UIViewController *) viewController animated :( BOOL) animated; @ property (nonatomic, retain) UIViewController * contentViewController; 2> set the size of popView (the size of popView is displayed when the default controller is large) (120, 44*3) UIPopoverController method popoverContentSize the method self set in the content controller. preferredContentSizeself. contentSizeForViewInPopover/ios7 out-of-date/3> set where to display the call method/*** the UIPopoverController method is displayed (1) ** @ param item displays the direction of the * @ param arrowDirections ctions arrow around which UIBarButtonItem * @ param animated indicates whether it is animated */-(void) presentPopoverFromBarButtonItem (UIBarButtonItem *) item permittedArrowDirections ctions :( UIPopoverArrowDirection) arrowDirections animated :( BOOL) animated; Scenario ② Add a button on the View of the navigation controller, click it, a UIPopoverController controller is displayed, and the Controller is then packaged with, display Level 2 Controller 1> call method/*** pop-up UIPopoverController ** @ param rect specify the Rectangular Box range (position and size) of the Area pointed by the arrow) * @ param view the rect parameter is based on the coordinate origin () * @ param arrowDirections ctions arrow direction in the upper left corner of the view * @ param animated whether it is displayed through an animation */-(void) presentPopoverFromRect :( CGRect) rect inView :( UIView *) view permittedArrowDirections ctions :( UIPopoverArrowDirection) arrowDirections animated :( BOOL) animated; 2> In the controller, the UIPopoverController disappears with its own logic structure (similar to the normal controller that can jump back, etc.). method [popopover dismissPopoverAnimated: YES] 4. use of UISplitViewController specific to iPad. masterViewController1> masterViewController (Main Controller) 2> displays the main menu content B. detailViewController1> detailViewController (details Controller) 2> displays details

Related Article

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.