Tag: IMG Res name ISP reserve OSI obj Nat oat
One, the relative position of rotation after the same
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvz29nbgvy/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/center ">
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvz29nbgvy/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/center ">
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvz29nbgvy/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/center ">
Second, the relative position change after rotation
2.1 Default:
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvz29nbgvy/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/center ">
2.2 After adjustment
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvz29nbgvy/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/center ">
Third, summary
3.1 Which directions are supported in app level settings:
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvz29nbgvy/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/center ">
3.2 Which orientations are supported at the Viewcontroller (Xlib) Level:
#import "JAViewController.h" @interface Javiewcontroller () @end @implementation javiewcontroller-(void) viewdidload{ [Super viewdidload];//do no additional setup after loading the view, typically from a nib.} -(void) didreceivememorywarning{ [Super didreceivememorywarning]; Dispose of any resources the can be recreated.} Override this method-(Nsuinteger) supportedinterfaceorientations{// return (uiinterfaceorientationmaskportrait| Uiinterfaceorientationmasklandscapeleft| Uiinterfaceorientationmaskportraitupsidedown);// return uiinterfaceorientationmaskall; Return (uiinterfaceorientationmasklandscaperight| Uiinterfaceorientationmasklandscapeleft| Uiinterfaceorientationmaskportraitupsidedown);} @end
3.3 using constraint contstraints
3.4 When the above contraints method is not satisfied, shut it down, let the later in the VIEWCONTROLLER.M through the code implementation.
javiewcontroller.m//restructure////Created by Jason on 14-7-16.//Copyright (c) 2014 Jason. All rights reserved.//#import "JAViewController.h" @interface Javiewcontroller () @property (weak, nonatomic) Iboutlet UIButton *actionbutton1; @property (weak, nonatomic) Iboutlet UIButton *actionbutton2; @property (weak, nonatomic) Iboutlet UIButton *actionbutton3; @property (weak, nonatomic) Iboutlet UIButton *actionbutton4; @property (Weak, nonatomic) Iboutlet UIView *contentview; @end @implementation javiewcontroller-(void) viewdidload{[Super Viewdidload] ;//start from here uiapplication *app = [UIApplication sharedapplication]; Uiinterfaceorientation currentorientation = app.statusbarorientation; [Self dolayoutfororientation:currentorientation];//jumps to actual processing place}-(void) didreceivememorywarning{[super Didreceivememorywarning]; Dispose of any resources the can be recreated.} Start Here-(void) Willanimaterotationtointerfaceorientation: (uiinterfaceorientation) tointerfaceorientation DuratIon: (Nstimeinterval) duration {[Self dolayoutfororientation:tointerfaceorientation]; }//determines the current direction-(void) Dolayoutfororientation: (uiinterfaceorientation) orientation{if (uiinterfaceorientationisportrait (orientation)) {[Self layoutportrait]; } else {[self layoutlandscape]; }}static const CGFloat buttonheight = 40;static Const CGFloat buttonwidth = 120;static Const cgfloat spacing = 20;//vertical Processing- (void) layoutportrait {cgrect b = self.view.bounds; CGFloat contentwidth = cgrectgetwidth (b)-(2 * spacing); CGFloat contentheight = cgrectgetheight (b)-(4 * spacing)-(2 * buttonheight); Self.contentView.frame = CGRectMake (spacing, spacing, contentwidth, contentheight); CGFloat buttonrow1y = Contentheight + (2 * spacing); CGFloat buttonrow2y = buttonrow1y + buttonheight + spacing; CGFloat buttoncol1x = spacing; CGFloat buttoncol2x = cgrectgetwidth (b)-buttonwidth-spacing; Self.actionButton1.frame = CGRectMake (buttoncol1x, buttonrow1y, Buttonwidth, buttonheight); Self.actionButton2.frame = CGRectMake (buttoncol2x, buttonrow1y, Buttonwidth, Butt Onheight); Self.actionButton3.frame = CGRectMake (buttoncol1x, buttonrow2y, Buttonwidth, Butt Onheight); Self.actionButton4.frame = CGRectMake (buttoncol2x, buttonrow2y, Buttonwidth, Butt Onheight);} Transverse processing-(void) Layoutlandscape {cgrect b = self.view.bounds; CGFloat contentwidth = cgrectgetwidth (b)-Buttonwidth-(3 * spacing); CGFloat contentheight = cgrectgetheight (b)-(2 * spacing); Self.contentView.frame = CGRectMake (spacing, spacing, contentwidth, contentheight); CGFloat Buttonx = cgrectgetwidth (b)-buttonwidth-spacing; CGFloat buttonrow1y = spacing; CGFloat buttonrow4y = cgrectgetheight (b)-Buttonheight-spacing; CGFloat buttonrow2y = buttonrow1y + Floor ((buttonrow4y-buttonrow1y) * 0.333 ); CGFloat buttonrow3y = buttonrow1y + Floor ((buttonrow4y-buttonrow1y) * 0.667 ); Self.actionButton1.frame = CGRectMake (Buttonx, buttonrow1y, Buttonwidth, Buttonhe ight); Self.actionButton2.frame = CGRectMake (Buttonx, buttonrow2y, Buttonwidth, Buttonhe ight); Self.actionButton3.frame = CGRectMake (Buttonx, buttonrow3y, Buttonwidth, Buttonhe ight); Self.actionButton4.frame = CGRectMake (Buttonx, buttonrow4y, Buttonwidth, Buttonhe ight);} @end
"Beginning IOS 7 Development" proficient in iOS7 development "autorotation and autosizing