ios8/sdk8/xcode6/iphone6(+)适配

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:

[email protected]~ipad.png (1536x2048 ~ for Retina  iPad Portrait)

Retina iPad:

[email protected]~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;
        _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
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.‘
*** First throw call stack:
(0x187d9e084 0x1986900e4 0x18cc56bf0 0x18c81e3f8 0x18c81cf30 0x18c5a2efc 0x18c5149c0 0x187d56388 0x187d53314 0x187d536f4 0x187c81664 0x190d7f5a4 0x18c5864f8 0x1000c574c 0x198cfea08)
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. Declaration
  6. OBJECTIVE-C
  7. @property(nonatomic, copy) UIActivityViewControllerCompletionHandler completionHandler
  8. Discussion
  9. 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.
  10. Import Statement
  11. Availability
  12. Available in iOS 6.0 and later.
  13. Deprecated in iOS 8.0.
Accessing the Completion Handler
completionHandler
 (iOS 8.0)
The completion handler to execute after the activity view controller is dismissed.

Declaration
OBJECTIVE-C
@property(nonatomic, copy) UIActivityViewControllerCompletionHandler completionHandler
Discussion
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.

Import Statement
Availability
Available in iOS 6.0 and later.

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. [[UIApplication sharedApplication] registerForRemoteNotifications];
  8. }
  9. else
  10. {
  11. //原来注册通知的代码
  12. [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
  13. (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
  14. }
   // IOS8 新的注册api
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings
                                                                             settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
                                                                             categories:nil]];

        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }
    else
    {
        //原来注册通知的代码
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }

原本在IOS7当中 判断push是否打开的方法是:

Java代码  

  1. UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
  2. return (types & UIRemoteNotificationTypeAlert);
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
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. return (types & UIRemoteNotificationTypeAlert);
  12. }
+(BOOL)enabledRemoteNotification{
    UIRemoteNotificationType types;
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
        types = [[UIApplication sharedApplication] currentUserNotificationSettings].types;
    }
    else
    {
        types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
    }

    return (types & UIRemoteNotificationTypeAlert);
}

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

含有uibutton的ScrollView在iOS8中无法滚动的解决办法:

Java代码  

  1. theScrollView.panGestureRecognizer.delaysTouchesBegan = theScrollView.delaysContentTouches
时间: 2024-10-09 04:34:07

ios8/sdk8/xcode6/iphone6(+)适配的相关文章

iPhone6适配指南

iOS版本升级适配一直是每年这个时候的一个话题,今年iPhone6以及iPhone6 Plus推出后,iOS的开发者终于也开始了苦逼的适配之路.本文我会从手淘以及天猫客户端现有需要做的一些方案着手,描述未来需要适配的一些方案. iPhone6适配主要从以下几个方面进行: 1.客户端UI 2.iOS8系统适配 3.UED的设计规范 4.测试增加回归 1.客户端UI适配 首先来看看iPhone6以及iPhone6 Plus的分辨率以及iOS 8中的UIScreen的宽高. iPhone 6 分辨率

Unity iPhone6适配

Unity 4.5.4f1是不适配iPhone 6 的,从Unity 4.5.4p1的Release Notes可以看出来. 但是4.5.4p1是在9月18号放出来的.我们在这之前就要做iOS 8 iPhone 6的适配了. 主要是App Icon和Launch Image方面的修改.我这里只说我们是怎么做的,而且我们的测试结果也是对的. 1. Unity编译之后,删除Images.xcassets目录下面的AppIcon.appiconset和LaunchImage.launchimage这两

ios8新特性屏幕适配之sizeclass

ios8推出也有一段时间了,由于时间比较紧,所以没去学习ios8的新特性, 随着iphone6,6+的推出,ios屏幕适配是一个大问题,如何成功适配各种尺寸以及ipad呢? 苹果公司为了解决这个问题给出了新技术sizeclass 下面是我对sizeclass学习的一些笔记,希望对大家有用: 1>屏幕适配的发展历程 代码计算frame -> autoreszing(父控件和子控件的关系ios6) -> autolayout(任何控件都可以产生关系ios7) -> sizeclass(

iOS8 【xcode6中添加pch全局引用文件】

前沿:xcode6中去掉了pch,为了一些琐碎的头文件引用,加快了 编译速度! code6之前的版本建项目就自动添加了是这样的: xcode6后的版本要自己手动的添加步骤如下: 1)  2) 3) $(SRCROOT)/pchFile.pch 这样就ok了! ------------------------------------------------------------------------------------------------------------------ 可能遇到问

0、IOS8:Xcode6 playground

一.Playground介绍 Playground是Xcode6中自带的Swift代码开发环境.俗话说“功欲善其事,必先利其器”.以前在Xcode5中编写脚本代码,例如编写JS,其编写过程很痛苦,Xcode编辑器对脚本语言编写支持不好,但Playground让编写Swift代码不在痛苦.使用Playground编写Swift代码,不需要编译Swift文件或运行一个要编译的工程,而可以快速的看到代码执行得结果及中间过程中的结果. 二.Playground环境搭建 1.打开Playground环境:

iOS8、Xcode6下 设置Launch Image 启动图片

如何设置app的启动图,也就是Launch Image? Step1 1.点击Image.xcassets 进入图片管理,然后右击,弹出"New Launch Image" 2.如图,右侧的勾选可以让你选择是否要对ipad,横屏,竖屏,以及低版本的ios系统做支持.这边我选了ios8.0,ios7.0,ios6没有做支持. Step2 将规定尺寸的图片从你的文件中拖动进到固定位置. 系统 尺寸 分辨率 ios8 Retina HD5.5 1242x2208   Retina HD4.7

iOS模拟器分辨率的问题(转载)

转载地址:http://justsee.iteye.com/blog/2123545 不积跬步 无以至千里 不积小流 无以成江海 博客 微博 相册 收藏 留言 关于我 ios8/sdk8/xcode6/iphone6(+)适配 博客分类: ios AppIcon https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/

iPhone屏幕尺寸、分辨率及适配

目录(?)[+] 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS 2.4 inches (62.1 mm) 4.5 inches (115.5 mm) 3.5-inch 320x480 @1x 320x480 163 4(s) 2.31 inches (58.6 mm) 4.5 inches (115.2 mm) 3.5-inch 320x480

【转】iPhone屏幕尺寸、分辨率及适配

原文网址:http://blog.csdn.net/phunxm/article/details/42174937 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS 2.4 inches (62.1 mm) 4.5 inches (115.5 mm) 3.5-inch 320x480 @1x 320x480 163 4(s) 2.31 inches