這篇文章將為大家詳細講解有關IOS如何實現點擊按鈕隱藏狀態(tài)欄,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

IOS點擊按鈕隱藏狀態(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:@"隱藏導航欄" 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];//調用該方法后系統會調用prefersStatusBarHidden方法
self.hideStatus = !self.hideStatus;
}
- (BOOL)prefersStatusBarHidden
{
return self.hideStatus;
}關于“IOS如何實現點擊按鈕隱藏狀態(tài)欄”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
另外有需要云服務器可以了解下創(chuàng)新互聯建站www.chinadenli.net,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
文章名稱:IOS如何實現點擊按鈕隱藏狀態(tài)欄-創(chuàng)新互聯
文章分享:http://www.chinadenli.net/article30/dossso.html
成都網站建設公司_創(chuàng)新互聯,為您提供網頁設計公司、服務器托管、網站設計公司、關鍵詞優(yōu)化、微信小程序、自適應網站
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯