第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在iOS 6中使應用程序完全正常運行以實現(xiàn)自動旋轉?

如何在iOS 6中使應用程序完全正常運行以實現(xiàn)自動旋轉?

iOS
慕哥6287543 2019-12-27 10:27:30
在iOS6中,shouldAutorotateToInterfaceOrientation已棄用。我試圖使用 supportedInterfaceOrientations和shouldAutorotate 制作應用程序的自轉,但未能正常工作。我不想旋轉此ViewController,但是它不起作用。- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{    return (interfaceOrientation == UIInterfaceOrientationPortrait);}-(BOOL)shouldAutorotate{    return NO;}-(NSUInteger)supportedInterfaceOrientations{    return UIInterfaceOrientationMaskPortrait;}有任何想法嗎?感謝您的任何幫助!
查看完整描述

2 回答

?
慕的地8271018

TA貢獻1796條經(jīng)驗 獲得超4個贊

弄清楚了。


1)子類化UINavigationController(層次結構的頂部viewcontroller將控制方向。)確實將其設置為self.window.rootViewController。


- (BOOL)shouldAutorotate

{

    return self.topViewController.shouldAutorotate;

}

- (NSUInteger)supportedInterfaceOrientations

{

    return self.topViewController.supportedInterfaceOrientations;

}

2)如果您不希望視圖控制器旋轉


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{

    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}


-(BOOL)shouldAutorotate

{

    return NO;

}


-(NSUInteger)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskPortrait;

}

3)如果您希望它能夠旋轉


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{

    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);

}


-(NSUInteger)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskAllButUpsideDown;

}


-(BOOL)shouldAutorotate

{

    return YES;

}

順便說一句,根據(jù)您的需要,另一種相關方法:


- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window

{

     return UIInterfaceOrientationMaskPortrait;

}


查看完整回答
反對 回復 2019-12-27
?
浮云間

TA貢獻1829條經(jīng)驗 獲得超4個贊

如果您使用標簽欄控制器而不是導航控制器作為根控制器,則需要類似地將UITabBarController子類化。


語法也會有所不同。我成功地使用了以下內容。然后,我在要覆蓋的視圖控制器上成功使用了上面的示例。就我而言,我希望主屏幕不旋轉,但是我有一個帶有電影的FAQ屏幕,我自然想啟用橫向視圖。完美地工作!只需注意self.modalViewController的語法更改即可(如果嘗試將語法用于導航控制器,則會收到編譯器警告。)希望這會有所幫助!


- (void)didReceiveMemoryWarning

{

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}


- (BOOL)shouldAutorotate

{

    return self.modalViewController.shouldAutorotate;

}


- (NSUInteger)supportedInterfaceOrientations

{

    return self.modalViewController.supportedInterfaceOrientations;

}


查看完整回答
反對 回復 2019-12-27
  • 2 回答
  • 0 關注
  • 602 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號