Skip to content

Commit

Permalink
add 6. Support Slide Over and Split View of iOS 9
Browse files Browse the repository at this point in the history
  • Loading branch information
pifupro_iOS_admin committed Jun 26, 2015
1 parent 71ee1a3 commit df2298d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ - (void)viewDidLoad
//注意:建议只请求⓵和⓶中的一个,如果两个权限都需要,只请求⓶即可,
//⓵⓶这样的顺序,将导致bug:第一次启动程序后,系统将只请求⓵的权限,⓶的权限系统不会请求,只会在下一次启动应用时请求⓶
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8) {
[_locationManager requestWhenInUseAuthorization];//⓵只在前台开启定位
// [self.locationManager requestAlwaysAuthorization];//⓶在后台也可定位
//[_locationManager requestWhenInUseAuthorization];//⓵只在前台开启定位
[self.locationManager requestAlwaysAuthorization];//⓶在后台也可定位
}
// 5.iOS9新特性:将允许出现这种场景:同一app中多个location manager:一些只能在前台定位,另一些可在后台定位(并可随时禁止其后台定位)。
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
Expand Down Expand Up @@ -143,7 +143,12 @@ - (BOOL)isCoordinateEmpty:(CLLocationCoordinate2D)regionCenter {
}

-(void)openGPSTips{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"当前定位服务不可用" message:@"请尝试到“设置->隐私->定位服务”中开启定位\n或等待GPS定位成功" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"当前定位服务不可用"
message:@"请尝试到“设置->隐私->定位服务”中开启定位\n或等待GPS定位成功"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil
];
[alert show];
int delayInSeconds = 2;
dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
Expand All @@ -170,7 +175,12 @@ - (void)showLineSwitchClicked:(UISwitch *)sender {
range:NSMakeRange(0, 2)];
self.titleLabel.attributedText = text;
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"只支持在iOS9及以上系统执行本操作" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"只支持在iOS9及以上系统执行本操作"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil
];
[alert show];
int delayInSeconds = 1;
dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
Expand All @@ -192,7 +202,6 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
CLPlacemark *placeInfo = [placemarks objectAtIndex:0];
NSString *title = [placeInfo.addressDictionary objectForKey:@"Name"];
NSString *subTitle = [placeInfo.addressDictionary objectForKey:@"FormattedAddressLines"][0];
//在未进行POI搜索时进行初始化,如果进行了POI搜索会进行重置
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude);
if(![self isCoordinateEmpty:coordinate]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:subTitle delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
Expand All @@ -204,8 +213,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
});
}
NSLog(@"位置在:%@", subTitle);
}
else {
} else {
[self openGPSTips];
}
}];
Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,26 @@ Any app built with SDK 9 needs to provide a `LSApplicationQueriesSchemes` entry

[19]: https://developer.apple.com/videos/wwdc/2015/?id=703

##6. Support Slide Over and Split View of iOS 9

![enter image description here](http://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2015/06/ew-.gif)
How to transition an an older project to support Slide Over and Split View of iOS 9?
You may find that all the demo projects was written by storyboard or xib,
but the older project's UI is written by code!

I would suggest switching to storyboards to make your life easy.

I would highly recommend you watch the following WWDC videos and then think about what exactly you need to do in order to support multi tasking.

1. [Mysteries of Auto Layout, Part 1](https://developer.apple.com/videos/wwdc/2015/?id=218)

2. [What's New in Storyboards][https://developer.apple.com/videos/wwdc/2015/?id=215]

3. [Implementing UI Designs in Interface Builder][https://developer.apple.com/videos/wwdc/2015/?id=407]

4. [Getting Started with Multitasking on iPad in iOS 9][https://developer.apple.com/videos/wwdc/2015/?id=205]

5. [Optimizing Your App for Multitasking on iPad in iOS][https://developer.apple.com/videos/wwdc/2015/?id=212]


> 中文
Expand Down Expand Up @@ -379,3 +399,24 @@ iOS9以后,企业级分发ipa包将遭到与Mac上dmg安装包一样的待遇

[20]: https://i.imgur.com/2HxWQqq.png


##6. iPad适配Slide Over 和 Split View

![enter image description here](http://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2015/06/ew-.gif)

【iPad适配Slide Over 和 Split View】
若想适配multi tasking特性,唯一的建议:弃纯代码,改用storyboard、xib,纵观苹果WWDC所有Demo均是如此:


1. [Mysteries of Auto Layout, Part 1](https://developer.apple.com/videos/wwdc/2015/?id=218)

2. [What's New in Storyboards][https://developer.apple.com/videos/wwdc/2015/?id=215]

3. [Implementing UI Designs in Interface Builder][https://developer.apple.com/videos/wwdc/2015/?id=407]

4. [Getting Started with Multitasking on iPad in iOS 9][https://developer.apple.com/videos/wwdc/2015/?id=205]

5. [Optimizing Your App for Multitasking on iPad in iOS][https://developer.apple.com/videos/wwdc/2015/?id=212]



0 comments on commit df2298d

Please sign in to comment.