diff --git a/Objective-C/TOCropViewController/TOCropViewController.m b/Objective-C/TOCropViewController/TOCropViewController.m index 9b2faf1d..abac3c9e 100755 --- a/Objective-C/TOCropViewController/TOCropViewController.m +++ b/Objective-C/TOCropViewController/TOCropViewController.m @@ -143,7 +143,9 @@ - (void)viewWillAppear:(BOOL)animated // so we can manually control the status bar fade out timing if (animated) { self.inTransition = YES; +#if TARGET_OS_IOS [self setNeedsStatusBarAppearanceUpdate]; +#endif } // If this controller is pushed onto a navigation stack, set flags noting the @@ -186,7 +188,9 @@ - (void)viewDidAppear:(BOOL)animated // Now that the presentation animation will have finished, animate // the status bar fading out, and if present, the title label fading in void (^updateContentBlock)(void) = ^{ +#if TARGET_OS_IOS [self setNeedsStatusBarAppearanceUpdate]; +#endif self.titleLabel.alpha = 1.0f; }; @@ -214,8 +218,10 @@ - (void)viewWillDisappear:(BOOL)animated // Set the transition flag again so we can defer the status bar self.inTransition = YES; +#if TARGET_OS_IOS [UIView animateWithDuration:0.5f animations:^{ [self setNeedsStatusBarAppearanceUpdate]; }]; - +#endif + // Restore the navigation controller to its state before we were presented if (self.navigationController && self.hidesNavigationBar) { [self.navigationController setNavigationBarHidden:self.navigationBarHidden animated:animated]; @@ -229,7 +235,9 @@ - (void)viewDidDisappear:(BOOL)animated // Reset the state once the view has gone offscreen self.inTransition = NO; +#if TARGET_OS_IOS [self setNeedsStatusBarAppearanceUpdate]; +#endif } #pragma mark - Status Bar - diff --git a/Objective-C/TOCropViewController/Views/TOCropOverlayView.m b/Objective-C/TOCropViewController/Views/TOCropOverlayView.m index 9568d8a3..257432b0 100644 --- a/Objective-C/TOCropViewController/Views/TOCropOverlayView.m +++ b/Objective-C/TOCropViewController/Views/TOCropOverlayView.m @@ -132,7 +132,7 @@ - (void)layoutLines } //grid lines - horizontal - CGFloat thickness = 1.0f / [[UIScreen mainScreen] scale]; + CGFloat thickness = 1.0f / self.traitCollection.displayScale; NSInteger numberOfLines = self.horizontalGridLines.count; CGFloat padding = (CGRectGetHeight(self.bounds) - (thickness*numberOfLines)) / (numberOfLines + 1); for (NSInteger i = 0; i < numberOfLines; i++) { diff --git a/Objective-C/TOCropViewControllerExample/ViewController.m b/Objective-C/TOCropViewControllerExample/ViewController.m index d9666a24..3ff95c28 100644 --- a/Objective-C/TOCropViewControllerExample/ViewController.m +++ b/Objective-C/TOCropViewControllerExample/ViewController.m @@ -75,13 +75,17 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking //If profile picture, push onto the same navigation stack if (self.croppingStyle == TOCropViewCroppingStyleCircular) { +#if TARGET_OS_IOS if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) { [picker dismissViewControllerAnimated:YES completion:^{ [self presentViewController:cropController animated:YES completion:nil]; }]; } else { +#endif [picker pushViewController:cropController animated:YES]; +#if TARGET_OS_IOS } +#endif } else { //otherwise dismiss, and then present from the main controller [picker dismissViewControllerAnimated:YES completion:^{ diff --git a/TOCropViewControllerExample.xcodeproj/project.pbxproj b/TOCropViewControllerExample.xcodeproj/project.pbxproj index 01d4df1f..447f1e2a 100644 --- a/TOCropViewControllerExample.xcodeproj/project.pbxproj +++ b/TOCropViewControllerExample.xcodeproj/project.pbxproj @@ -1005,6 +1005,10 @@ PRODUCT_BUNDLE_IDENTIFIER = dev.tim.TOCropViewController; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1042,6 +1046,10 @@ PRODUCT_BUNDLE_IDENTIFIER = dev.tim.TOCropViewController; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1067,6 +1075,9 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.timoliver.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TOCropViewControllerExample.app/TOCropViewControllerExample"; }; name = Debug; @@ -1087,6 +1098,9 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.timoliver.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TOCropViewControllerExample.app/TOCropViewControllerExample"; }; name = Release; @@ -1223,7 +1237,9 @@ ); PRODUCT_BUNDLE_IDENTIFIER = dev.tim.TOCropViewControllerExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Debug; }; @@ -1246,7 +1262,9 @@ ); PRODUCT_BUNDLE_IDENTIFIER = dev.tim.TOCropViewControllerExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Release; }; @@ -1342,8 +1360,10 @@ PRODUCT_BUNDLE_IDENTIFIER = dev.tim.CropViewController; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1385,8 +1405,10 @@ PRODUCT_BUNDLE_IDENTIFIER = dev.tim.CropViewController; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; SWIFT_COMPILATION_MODE = wholemodule; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1419,7 +1441,9 @@ PRODUCT_BUNDLE_IDENTIFIER = "dev.tim.TOCropViewControllerExample.TOCropViewController-ShareExtension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Debug; }; @@ -1446,7 +1470,9 @@ PRODUCT_BUNDLE_IDENTIFIER = "dev.tim.TOCropViewControllerExample.TOCropViewController-ShareExtension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Release; };