IOS點擊按鈕隱藏狀態(tài)欄詳解及實例代碼
更新時間:2017年02月11日 16:32:11 投稿:lqh
這篇文章主要介紹了IOS點擊按鈕隱藏狀態(tài)欄詳解及實例代碼的相關(guān)資料,需要的朋友可以參考下
IOS點擊按鈕隱藏狀態(tài)欄詳解
前言:
最近學(xué)習(xí)IOS的基礎(chǔ)知識,實現(xiàn)隱藏狀態(tài)欄的功能,這里就記錄下來,希望對大家有所幫助
實例代碼:
@interface SecondViewController () @property (nonatomic, assign,getter=isHideStatus) BOOL hideStatus; @end @implementation SecondViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 300, 200)]; button.center = self.view.center; button.backgroundColor = [UIColor blueColor]; [button setTitle:@"隱藏導(dǎo)航欄" forState:UIControlStateNormal]; [button addTarget:self action:@selector(hideFrame) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; self.hideStatus = [UIApplication sharedApplication].statusBarHidden; // Do any additional setup after loading the view, typically from a nib. } - (void)hideFrame { [self setNeedsStatusBarAppearanceUpdate];//調(diào)用該方法后系統(tǒng)會調(diào)用prefersStatusBarHidden方法 self.hideStatus = !self.hideStatus; } - (BOOL)prefersStatusBarHidden { return self.hideStatus; }
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
iOS界面跳轉(zhuǎn)時導(dǎo)航欄和tabBar的隱藏與顯示功能
這篇文章主要介紹了iOS界面跳轉(zhuǎn)時導(dǎo)航欄和tabBar的隱藏與顯示功能,需要的朋友可以參考下2017-02-02IOS中(assign,retain,copy,weak,strong)的區(qū)別以及nonatomic的含義
這篇文章主要介紹了我們在聲明@property 屬性時,總是要在括號中寫上assign、retain、copy、weak、strong中的一個,他們的區(qū)別,需要的朋友可以參考下2017-03-03