IOS 啓動畫面設置

 轉載:http://justsee.iteye.com/blog/2123545

2014年,蘋果又出了兩種尺寸,這裏標註下,以後再有新尺寸,再繼續更新。


AppIcon

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW1

Table 39-1Size (in pixels) of custom icons and images

Asset

iPhone 6 Plus (@3x)

iPhone 6 and iPhone 5 (@2x)

iPhone 4s (@2x)

iPad and iPad mini (@2x)

iPad 2 and iPad mini (@1x)

App icon (required for all apps)

180 x 180

120 x 120

120 x 120

152 x 152

76 x 76

App icon for the App Store (required for all apps)

1024 x 1024

1024 x 1024

1024 x 1024

1024 x 1024

1024 x 1024

Launch file or image (required for all apps)

Use a launch file (seeLaunch Images)

For iPhone 6, use a launch file (see Launch Images)

For iPhone 5, 640 x 1136

640 x 960

1536 x 2048 (portrait)

2048 x 1536 (landscape)

768 x 1024 (portrait)

1024 x 768 (landscape)

Spotlight search results icon (recommended)

120 x 120

80 x 80

80 x 80

80 x 80

40 x 40

Settings icon (recommended)

87 x 87

58 x 58

58 x 58

58 x 58

29 x 29

Toolbar and navigation bar icon (optional)

About 66 x 66

About 44 x 44

About 44 x 44

About 44 x 44

About 22 x 22

Tab bar icon (optional)

About 75 x 75 (maximum: 144 x 96)

About 50 x 50 (maximum: 96 x 64)

About 50 x 50 (maximum: 96 x 64)

About 50 x 50 (maximum: 96 x 64)

About 25 x 25 (maximum: 48 x 32)

Default Newsstand cover icon for the App Store (required for Newsstand apps)

At least 1024 pixels on the longest edge

At least 1024 pixels on the longest edge

At least 1024 pixels on the longest edge

At least 1024 pixels on the longest edge

At least 512 pixels on the longest edge

Web clip icon (recommended for web apps and websites)

180 x 180

120 x 120

120 x 120

152 x 152

76 x 76

 

 

iphone6/6+ 更新:

[email protected]     87*87

[email protected]           120*120

[email protected]           180*180

Icon.png                        57*57

[email protected]                114*114

Icon-Small.png                29*29

[email protected]            58*58

Icon-Small-50.png            50*50

[email protected]        100*100

Icon-72.png                    72*72

[email protected]                144*144

Icon-40.png                    40*40

[email protected]                80*80

Icon-60.png                    60*60

[email protected]                120*120

Icon-76.png                    76*76

[email protected]                152*152

 

 酷LaunchImage

 https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/LaunchImages.html#//apple_ref/doc/uid/TP40006556-CH22-SW1

For iPhone 6

750 x 1334 (@2x) for portrait

1334 x 750 (@2x) for landscape

For iPhone 6 Plus:

1242 x 2208 (@3x) for portrait

2208 x 1242 (@3x) for landscape

---------------------------------------------------------------------

 

4.0 inch screen:

[email protected] (old 640x1136 ~ for iPhone 5)

4.0 inch screen: 

[email protected] (new 640x1136 ~ for iPhone 5)

 

4.7 inch screen: 

[email protected] (750x1334 ~ for iPhone 6)

 

5.5 inch screen: 

[email protected] (1242x2208 ~ for iPhone 6 Plus Portrait)

5.5 inch screen: 

[email protected] (2208x1242 ~ for iPhone 6 Plus Landscape)

 

Retina iPad:

Default-Portrait@2x~ipad.png (1536x2048 ~ for Retina  iPad Portrait)

Retina iPad:

Default-Landscape@2x~ipad.png (2048x1536 ~ for Retina  iPad Landscape)

iPad Mini/iPad:

Default-Portrait~ipad.png (768x1024 ~ for  iPad Portrait)

iPad Mini/iPad:

Default-Landscape~ipad.png (1024x768 ~ for  iPad Landscape)

 

酷適配iphone6/6+啓動界面

 

如果舊的工程直接跑到這兩個模擬器中時,默認是"兼容模式",即系統會簡單的把內容等比例放大,顯示效果有些模糊但尚可接受。此時App內部獲取到的設備分辨率和iPhone5是一樣的:320*568 point。

 

啓用高分辨率模式有2個方法:

1.添加大屏的LaunchImage:

在Images.xcassets裏,刪除舊的LaunchImage組,然後新建LaunchImage組,添加對應高分辨率的圖片。(參考:http://matthewpalmer.net/blog/2014/09/10/iphone-6-plus-launch-image-adaptive-mode/



 

2.添加Launch Screen File

Launch Screen是Xcode6和iOS8新加的功能,它用一個xib文件來作爲啓動畫面。App在舊版iOS(低於ios8)啓動時,該屬性會被自動忽略,不會造成異常。

首先,點擊New File ->iOS User Interface ->Launch Screen,然後在工程設置項裏啓用它:

LaunchFile



 不過這個xib不能關聯任何的代碼(不能自定義View的Class,不能IBOutlet,不能加Object),可以理解成這個xib就是一張截圖,這個方案的好處在於可以使用到Size Classes來針對不同屏幕布局這個xib。

 

上面兩處設置,只要啓用任意一個即可讓App進入高分辨率模式;但如果兩處都沒有設置,則App會回退到兼容模式。

兩處都設定的話在ios8會走Launch Screen File,在低於ios8 走LaunchImage

 

PS:iPhone4、iPhone5、iPhone6這幾個設備的ppi都是相同的,默認圖片優先是@2x。iPhone6 Plus的像素密度更高,默認圖片優先是@3x。 另外,iPhone6 Plus有一點和其他設備不同:在App內部獲得的屏幕分辨率是1242*2208,但設備實際分辨率是1920*1080,這時系統會把整體的顯示內容做一個縮放,downscale到1/1.15。

 

 

 

 

酷 UIPageControl的autoresizingMask

 

在設置UIPageControl實例的寬度時,顯示的好像總是設置的四倍左右,但是把其他組建(UILable等)設置在同一父容器中顯示的是正常的。頭文件看到UIPageControl的autoresizingMask默認值是UIViewAutoresizingNone,但是感覺沒起作用,於是這是下

Java代碼  收藏代碼
  1. _mainPageControl.autoresizingMask = UIViewAutoresizingNone;  

 UIPageControl顯示正確了。(apple的bug?)

 

酷UIActivityViewController crashing on iPads by sdk8

其老早在 https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIActivityViewController_Class/ 中就說了:On iPad, you must present the view controller in a popover. On iPhone and iPod touch, you must present it modally

在sdk8之前你ipad還是用了presentViewController,那在dismissViewControllerAnimated的時候屏幕會旋轉下,可能你還能接受,但是在sdk8便會直接crash,報錯:

 

Java代碼  收藏代碼
  1. 2014-10-15 14:03:25.927 BT2014[5133:488272] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x145578890>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'  
  2. *** First throw call stack:  
  3. (0x187d9e084 0x1986900e4 0x18cc56bf0 0x18c81e3f8 0x18c81cf30 0x18c5a2efc 0x18c5149c0 0x187d56388 0x187d53314 0x187d536f4 0x187c81664 0x190d7f5a4 0x18c5864f8 0x1000c574c 0x198cfea08)  
  4. libc++abi.dylib: terminating with uncaught exception of type NSException  
 所以用sdk8編譯時ipad用pop,並且用新類:UIPopoverPresentationController

 

 

酷UIActivityViewController

Java代碼  收藏代碼
  1. Accessing the Completion Handler  
  2. completionHandler  
  3.  (iOS 8.0)  
  4. The completion handler to execute after the activity view controller is dismissed.  
  5.   
  6. Declaration  
  7. OBJECTIVE-C  
  8. @property(nonatomic, copy) UIActivityViewControllerCompletionHandler completionHandler  
  9. Discussion  
  10. When the user-selected service finishes operating on the data, or when the user dismisses the view controller, the view controller executes this completion handler to let your app know the final result of the operation.  
  11.   
  12. Import Statement  
  13. Availability  
  14. Available in iOS 6.0 and later.  
  15.   
  16. Deprecated in iOS 8.0.  

 

酷"LaunchServices: invalidationHandler called" with UIActivityViewController iOS8

In iOS8 when I present or dismiss a UIActivityViewController, my app logs: "LaunchServices: invalidationHandler called"。

參考:https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPopoverPresentationController_class/index.html

https://devforums.apple.com/message/1049415#1049415

http://stackoverflow.com/questions/25192313/sharing-via-uiactivityviewcontroller-to-twitter-facebook-etc-causing-crash

可能是蘋果的issue

 

酷ios sdk8/ios8 remoteNotification 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

在蘋果UIApplication文件中說明:

@interface UIApplication (UIRemoteNotifications)

.

.

.

 

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types NS_DEPRECATED_IOS(3_0, 8_0, "Please use registerForRemoteNotifications and registerUserNotificationSettings: instead");

 

// Returns the enabled types, also taking into account any systemwide settings; doesn't relate to connectivity.

- (UIRemoteNotificationType)enabledRemoteNotificationTypes NS_DEPRECATED_IOS(3_0, 8_0, "Please use -[UIApplication isRegisteredForRemoteNotifications], or -[UIApplication currentUserNotificationSettings] to retrieve user-enabled remote notification and user notification settings");

 

 

@end

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

所以在ios8中應該用的新的註冊通知的代碼:

C代碼  收藏代碼
  1. // IOS8 新的註冊api  
  2.  if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)  
  3.  {  
  4.      [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings  
  5.                                                                           settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)  
  6.                                                                           categories:nil]];  
  7.        
  8.        
  9.      [[UIApplication sharedApplication] registerForRemoteNotifications];  
  10.  }  
  11.  else  
  12.  {  
  13.      //原來註冊通知的代碼  
  14.      [[UIApplication sharedApplication] registerForRemoteNotificationTypes:  
  15.       (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];  
  16.  }  

 原本在IOS7當中 判斷push是否打開的方法是:

Java代碼  收藏代碼
  1. UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];  
  2. return (types & UIRemoteNotificationTypeAlert);  

 

如果將這段代碼使用在 IOS8當中,雖然不會出現crash的現象,但永遠返回空。 在IOS8中,我們使用如下的新代碼來取代以上的代碼:

Java代碼  收藏代碼
  1. +(BOOL)enabledRemoteNotification{  
  2.     UIRemoteNotificationType types;  
  3.     if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)  
  4.     {  
  5.         types = [[UIApplication sharedApplication] currentUserNotificationSettings].types;  
  6.     }  
  7.     else  
  8.     {  
  9.         types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];  
  10.     }  
  11.       
  12.       
  13.     return (types & UIRemoteNotificationTypeAlert);  
  14. }  

 

酷ios 8 - buttons in horizontal scroll view intercepting pan event - scroll does not work

 含有uibutton的ScrollView在iOS8中無法滾動的解決辦法:

Java代碼  收藏代碼
  1. theScrollView.panGestureRecognizer.delaysTouchesBegan = theScrollView.delaysContentTouches  

 

 



發佈了13 篇原創文章 · 獲贊 7 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章