ipad Development Brief Introduction

Source: Internet
Author: User

    • The biggest difference in ipad development is the adaptation of the onscreen controls to the iphone and the rotation of the screen.
    • Storyboard in the Sizeclass of the screen configuration, also does not support the development of the ipad.
1. In the controller to get the direction of rotation of the device in IOS8 and later, the screen only after the rotation screen size, no longer the direction of the rotation of the expired.
    • How to get the screen rotation direction in iOS7 and before
/**//uiinterfaceorientation, screen orientation Uiinterfaceorientationunknown = Uideviceorientationunknown, uiinterfaceorientationportrait = uideviceorientationportrait, Uiinterfaceorientationportraitupsidedown = Uideviceorientationportraitupsidedown, Uiinterfaceorientationlandscapeleft = Uideviceorientationlandscaperight, Uiinterfaceorientationlandscaperight = Uideviceorientationlandscapeleft */-(void) Willanimaterotationtointerfaceorientation: (uiinterfaceorientation) tointerfaceorientation duration :(nstimeinterval) duration{//will be rotated to perform the animation NSLog (@ "%s", __func__);} -(void) Willrotatetointerfaceorientation: (uiinterfaceorientation) tointerfaceorientation Duration: (  Nstimeinterval) duration{//will be rotated NSLog (@ "%s", __func__);}         
    • After iOS8, the screen is only the screen, that is, when the screen is wide and high is the horizontal screen, or vertical screen.

      • ipad screen only (1024 * 768) Horizontal screen
      • (768 * 1024) Vertical screen
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator{    // 1.判断是否是横屏 BOOL isLandscape = size.width == 1024; // 2.设置Dock的宽度和高度 // 获取屏幕旋转动画执行的时间 CGFloat duration = [coordinator transitionDuration]; [UIView animateWithDuration:duration animations:^{ }];}
The way and style of modal pop-up controller in 2.iPad modal common there are 4 rendering style controller properties Modalpresentationstyle
  • Uimodalpresentationfullscreen: Full screen display (default)
  • Uimodalpresentationpagesheet

    • Width: Width of vertical screen (768)
    • Height: The height of the current screen (fills the entire height)
        • Uimodalpresentationcurrentcontext: Follow the rendering style of the parent controller

        Modal altogether 4 transition style controller properties Modaltransitionstyle
        • Uimodaltransitionstylecoververtical: Drill up from bottom (default)
        • Uimodaltransitionstylefliphorizontal: three-dimensional flip
        • Uimodaltransitionstylecrossdissolve: Fade in and fade out
        • Uimodaltransitionstylepartialcurl: Page Turn (show only part, use premise: Render style must be Uimodalpresentationfullscreen)
        • Uimodalpresentationcustom
        • Uimodalpresentationoverfullscreen
        • Uimodalpresentationovercurrentcontext
        • Uimodalpresentationpopover//ios8 after transition style pop style
        • Uimodalpresentationnone
        3. Use case for ipad-specific Uipopovercontroller:
      • Scenario ① Add the Leftbarbuttonitem button to the navigation bar and then pop up Uipopovercontroller
          • Create a content controller for the Uipopovercontroller controller to add to the Uipopovercontroller
        1> Setting up content controllers (and creating content controllers first)
          • 强调Uipopovercontroller does not inherit Uiviewcontroller, it does not have a display function, to set content, to set content using Initwithcontentviewcontroller
        - (id)initWithContentViewController:(UIViewController *)viewController;- (void)setContentViewController:(UIViewController *)viewController animated:(BOOL)animated;@property (nonatomic, retain) UIViewController *contentViewController;
        2> Setting Dimensions
          • Set the size of the Popview (how large the default controller is) (120, 44 * 3)

            • Method of Uipopovercontroller Popovercontentsize
            • Methods set in the content controller

              • Self.preferredcontentsize
              • Self.contentsizeforviewinpopover/iOS7 obsolete /
        Where 3> settings are displayed
          • Calling methods
        /** *  弹出UIPopoverController的方法(一) * *  @param item            围绕着哪个UIBarButtonItem显示 *  @param arrowDirections 箭头的方向 *  @param animated        是否通过动画显示出来 */- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
        Scenario ② Add a button on the view of the navigation controller, click, pop up a Uipopovercontroller controller, and then this controller is then packaged with a navigation controller, showing a level two controller
          • 1> Calling Method
        /** *  弹出UIPopoverController * *  @param rect            指定箭头所指区域的矩形框范围(位置和尺寸) *  @param view            rect参数是以view的左上角为坐标原点(0,0) *  @param arrowDirections 箭头的方向 *  @param animated        是否通过动画显示出来 */- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
          • 2> Controller, with its own logical structure (as normal controller can jump back, etc.)
        Uipopovercontroller disappeared,
          • Method

            [Popover dismissPopoverAnimated:YES]
        4.iPad unique use of the Uisplitviewcontroller A.masterviewcontroller
          • 1>masterviewcontroller (Primary Controller)
          • 2> is responsible for displaying the main menu content
        B.detailviewcontroller
          • 1>detailviewcontroller (Detail Controller)
          • 2> is responsible for displaying detailed content

ipad Development Brief Introduction

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.