小编jor*_*gan的帖子

iOS 7 - 不推荐使用region.center

我有这个代码用于我的iOS应用程序:

NSString *location = [[NSString alloc] initWithFormat:@"%@, %@", [self.campus campusStreetAddress], [self.campus campusCityStateZip]];
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:location
             completionHandler:^(NSArray* placemarks, NSError* error){
                 if (placemarks && placemarks.count > 0) {
                     CLPlacemark *topResult = [placemarks objectAtIndex:0];
                     MKPlacemark *placemark = [[MKPlacemark alloc] initWithPlacemark:topResult];
                     MKCoordinateRegion region = self.campusMap.region;
                     region.center = placemark.region.center; //DEPRECATED iOS 7
                     region.span.longitudeDelta /= 1500;
                     region.span.latitudeDelta /= 1500;
                     [self.campusMap setRegion:region animated:NO];
                     [self.campusMap addAnnotation:placemark];
                 }
             }
 ];
Run Code Online (Sandbox Code Playgroud)

但是,当我将我的应用程序升级到iOS 7时,不推荐使用placemark.region.center.我应该使用替代品吗?这甚至是在视图中创建地图的正确方法吗?

谢谢!!

maps ios ios7

7
推荐指数
2
解决办法
5027
查看次数

Parse.com UIRemoteNotificationType已过时

按照推送通知的Parse.com教程,我把这个Swift代码放到我的应用程序didFinishLaunchingWithOptions方法中:

        // Register for Push Notitications
    if application.applicationState != UIApplicationState.Background {
        // Track an app open here if we launch with a push, unless
        // "content_available" was used to trigger a background push (introduced in iOS 7).
        // In that case, we skip tracking here to avoid double counting the app-open.

        let preBackgroundPush = !application.respondsToSelector("backgroundRefreshStatus")
        let oldPushHandlerOnly = !self.respondsToSelector("application:didReceiveRemoteNotification:fetchCompletionHandler:")
        var pushPayload = false
        if let options = launchOptions {
            pushPayload = options[UIApplicationLaunchOptionsRemoteNotificationKey] != nil
        }
        if (preBackgroundPush || oldPushHandlerOnly || …
Run Code Online (Sandbox Code Playgroud)

ios parse-platform

6
推荐指数
1
解决办法
2213
查看次数

iOS - 仅在视频上允许横向模式

我的应用程序中有视频.一些使用MPMoviePlayerController,其他人使用YouTube的UIWebView.我希望我的应用程序完全是肖像.但是,我想让用户选择在有视频时翻转到横向(不是强制,而是可选).

我一直在网上搜索答案,但我还没有找到任何答案.

谢谢你的帮助!

video ios landscape-portrait

3
推荐指数
1
解决办法
5459
查看次数

标签 统计

ios ×3

ios7 ×1

landscape-portrait ×1

maps ×1

parse-platform ×1

video ×1