當前位置:編程學習大全網 - 源碼下載 - ios plist文件怎麽添加

ios plist文件怎麽添加

Info.plist配置項說明1、設置啟動圖標(CFBundleIcons)<key>CFBundleIcons</key><dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconFiles</key> <array> <string>Icon</string> <string>Icon@2x</string> <string>Icon_120@2x</string> </array> </dict></dict>2、設置啟動閃屏圖片(UILaunchImages)<key>UILaunchImages</key><array> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>7.0</string> <key>UILaunchImageName</key> <string>Default</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{320, 568}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>7.0</string> <key>UILaunchImageName</key> <string>Default</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{320, 480}</string> </dict></array>3、設置版本號相關(1)設置Bundle的版本號(Bundle versions string, short)。壹般包含該束的主、次版本號,這個字符串的格式通常是“n.n.n”(n表示某個數字,如1.1.1)。第壹個數字是束的主要版本號,另兩個是次要版本號。該關鍵字的值會被顯示在Cocoa應用程序的關於對話框中。該關鍵字不同於CFBundleVersion,它指定了壹個特殊的創建號。而CFBundleShortVersionString的值描述了壹種更加正式的並且不隨每壹次創建而改變的版本號。<key>CFBundleShortVersionString</key><string>1.0</string>(2)設置應用程序版本號(Bundle version)。每次部署應用程序的壹個新版本時,將會增加這個編號,用於標識不同的版本。<key>CFBundleVersion</key><string>1.0</string>4、設置字體相關(Fonts provided by application)在iOS應用中需要使用系統提供的字體之外的字體,可以將字體文件(.ttf/.odf)復制到項目文件中,另外需要在Info.plist中添加Fonts provided by application的項,對應的源碼文件如下:<key>UIAppFonts</key><array> <string>華文行楷.ttf</string> <string>華文新魏.ttf</string> <string>黑體_GB2312.ttf</string></array>P.S關於如何使用系統支持的字體信息:(1)在調用字體的時候,要使用字體名。字體名不是文件名,而是字體的Family Name。Family Name可以在Font Book中查看。label.font = [UIFont fontWithName:@"字體名稱" size:16.0];(2)遍歷出系統支持的全部字體NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];for(int indFamily = 0; indFamily < familyNames.count; ++indFamily){ NSLog(@"Family Name: %@", [familyNames objectAtIndex:indFamily]); NSString *fontFamilyName = [familyNames objectAtIndex:indFamily]; NSArray *fontNames = [[NSArray alloc] initWithArray:[UIFont fontNamesForFamilyName:fontFamilyName]]; for(int indFont = 0; indFont < fontNames.count; ++indFont) { NSLog(@" Font Name: %@", [fontNames objectAtIndex:indFont]); }}5、設置應用名稱(Bundle display name)<key>CFBundleDisplayName</key><string>應用程序名稱</string>可以通過在InfoPlist.strings中使用配置讓應用在不同的語言環境下顯示不同的應用名稱,如在English中使用CFBundleDisplayName="Hello World";配置應用程序的名稱為Hello World,在Chinese的環境下使用CFBundleDisplayName="妳好世界";配置應用程序的名稱為妳好世界。6、設置應用標識號(Bundle identifier)<key>CFBundleIdentifier</key><string>com.devzeng.demo</string>7、設置應用支持的屏幕方向(Supported interface orientations)iOS應用程序支持以下四個方向的設置:UIInterfaceOrientationPortrait(默認豎直方向,HOME鍵向下)、UIInterfaceOrientationLandscapeLeft(橫屏靠左)、UIInterfaceOrientationLandscapeRight(橫屏向右)和UIInterfaceOrientationPortraitUpsideDown(豎直方向倒置,HOME鍵向上)對應的配置源碼如下:<key>UISupportedInterfaceOrientations</key><array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationPortraitUpsideDown</string></array>8、設置應用程序是否支持後臺運行(Application does not run in background)通過UIApplicationExitsOnSuspend可以設置iOS的應用程序進入到掛起狀態下是否立即退出,設置為YES表示不支持後臺運行退出到後臺立即退出,設置為NO表示支持後臺運行。(1)設置支持後臺運行<key>UIApplicationExitsOnSuspend</key><false/>(2)設置不支持後臺運行<key>UIApplicationExitsOnSuspend</key><true/>

  • 上一篇:2018麥田音樂節貴賓票和普通片有什麽區別?
  • 下一篇:夢見找袋裝西瓜的預兆
  • copyright 2024編程學習大全網