UIApplication,iosuiapplication

來源:互聯網
上載者:User

UIApplication,iosuiapplication

一、做一些應用層級的操作(比如在應用程式的表徵圖上顯示數字等):

- (IBAction)changeAppNum {
    UIApplication *app = [UIApplication sharedApplication];


//    1. 設定是否顯示狀態列和狀態列中文字表徵圖的顏色,在iOS7.0中要通過UIApplication來設定的話,在Info.plist設定View controller-based status bar appearance == NO
//    [app setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    
//    app.statusBarHidden = YES;
//    app.statusBarStyle = UIStatusBarStyleLightContent;
      [app setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
    
//    2.
//    0代表清除表徵圖右上方的數字
//    app.applicationIconBadgeNumber = 0;
    
//    設定顯示連網狀態(螢幕頂部轉圈的菊花)。
//    app.networkActivityIndicatorVisible = YES;
    
//    URL : 一個資源的唯一路徑。
//    URL的組成 == 協議頭://主機網域名稱/路徑
    
//    網路資源URL的組成 == http://www.baidu.com/1.png
    
//    本地資源(訪問自己手機或電腦上的資源),網域名稱可不寫。
//    本地檔案資源URL的組成 == file:///Users/apple/Desktop/1.png
    
//    用app開啟資源的好處:自動識別協議的類型,決定用什麼開啟。
//    [app openURL:[NSURL URLWithString:@"http://ios.itcast.cn"]];
    
//    打電話等
//    [app openURL:[NSURL URLWithString:@"tel://10086"]];
}

 

二、UIApplication的delegate:

/** app進入背景時候調用, 一般在這裡儲存應用的資料(遊戲資料,比如暫停遊戲) */
- (void)applicationDidEnterBackground:(UIApplication *)application
{
     NSLog(@"applicationDidEnterBackground");
}

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.