午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    iPhone屏幕旋轉(zhuǎn)的例子
    來源:易賢網(wǎng) 閱讀:1109 次 日期:2014-11-04 09:05:14
    溫馨提示:易賢網(wǎng)小編為您整理了“iPhone屏幕旋轉(zhuǎn)的例子”,方便廣大網(wǎng)友查閱!

    先在interface builder上放上6個(gè)rectbutton,豎放,一排三個(gè)

    然后我們下面來看代碼

    .h文件代碼

    1 //

    2 // AutoSizeViewController.h

    3 // AutoSize

    4 //

    5 // Created by Scott on 10-10-26.

    6 // Copyright 2010 __MyCompanyName__. All rights reserved.

    7 //

    8

    9 #import

    10

    11 @interface AutoSizeViewController : UIViewController {

    12 UIButton *button1;

    13 UIButton *button2;

    14 UIButton *button3;

    15 UIButton *button4;

    16 UIButton *button5;

    17 UIButton *button6;

    18 }

    19

    20 @property (nonatomic,retain) IBOutlet UIButton *button1;

    21 @property (nonatomic,retain) IBOutlet UIButton *button2;

    22 @property (nonatomic,retain) IBOutlet UIButton *button3;

    23 @property (nonatomic,retain) IBOutlet UIButton *button4;

    24 @property (nonatomic,retain) IBOutlet UIButton *button5;

    25 @property (nonatomic,retain) IBOutlet UIButton *button6;

    26 @end

    27

    下面我們看.m的代碼

    //

    // AutoSizeViewController.m

    // AutoSize

    //

    // Created by Scott on 10-10-26.

    // Copyright 2010 __MyCompanyName__. All rights reserved.

    //

    #import "AutoSizeViewController.h"

    @implementation AutoSizeViewController

    @synthesize button1;

    @synthesize button2;

    @synthesize button3;

    @synthesize button4;

    @synthesize button5;

    @synthesize button6;

    /*

    // The designated initializer. Override to perform setup that is required before the view is loaded.

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))

    {

    // Custom initialization

    }

    return self;

    }

    */

    /*

    // Implement loadView to create a view hierarchy programmatically, without using a nib.

    - (void)loadView {

    }

    */

    /*

    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

    - (void)viewDidLoad {

    [super viewDidLoad];

    }

    */

    // Override to allow orientations other than the default portrait orientation.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    // Return YES for supported orientations

    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);

    }

    - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration

    {

    if (interfaceOrientation==UIInterfaceOrientationPortrait || interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown) {

    button1.frame=CGRectMake(20, 20, 125, 125);

    button2.frame=CGRectMake(175, 20, 125, 125);

    button3.frame=CGRectMake(20, 168, 125, 125);

    button4.frame=CGRectMake(175, 168, 125, 125);

    button5.frame=CGRectMake(20, 315, 125, 125);

    button6.frame=CGRectMake(175, 315, 125, 125);

    }else {

    button1.frame=CGRectMake(20, 20, 125, 125);

    button2.frame=CGRectMake(20, 155, 125, 125);

    button3.frame=CGRectMake(177, 20, 125, 125);

    button4.frame=CGRectMake(177, 155, 125, 125);

    button5.frame=CGRectMake(328, 20, 125, 125);

    button6.frame=CGRectMake(328, 155, 125, 125);

    }

    }

    - (void)didReceiveMemoryWarning {

    // Releases the view if it doesn't have a superview.

    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.

    }

    - (void)viewDidUnload {

    // Release any retained subviews of the main view.

    // e.g. self.myOutlet = nil;

    self.button1=nil;

    self.button2=nil;

    self.button3=nil;

    self.button4=nil;

    self.button5=nil;

    self.button6=nil;

    [super viewDidUnload];

    }

    - (void)dealloc {

    [button1 release];

    button2.release;

    button3.release;

    button4.release;

    button5.release;

    button6.release;

    [super dealloc];

    }

    @end

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看技術(shù)文章
    易賢網(wǎng)手機(jī)網(wǎng)站地址:iPhone屏幕旋轉(zhuǎn)的例子
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2025國(guó)考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)