From 249d118b458c8f8b70d158874b58a7db1c704834 Mon Sep 17 00:00:00 2001 From: mbh Date: Mon, 18 Jul 2016 08:01:38 +0200 Subject: [PATCH] FIX Message shown with wrong location and size when orientation is UIInterfaceOrientationMaskPortraitUpsideDown. FIX Allow demo app to rotate to UIInterfaceOrientationMaskPortraitUpsideDown. --- CRToast/CRToastViewController.m | 4 ++++ Example/CRToastDemo.xcodeproj/project.pbxproj | 11 ++++++----- Example/CRToastDemo/AppDelegate.m | 3 ++- ...INavigationControllerWIthUpsideDownSupport.h | 13 +++++++++++++ ...INavigationControllerWIthUpsideDownSupport.m | 17 +++++++++++++++++ 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.h create mode 100644 Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.m diff --git a/CRToast/CRToastViewController.m b/CRToast/CRToastViewController.m index a4d511d2..5ecca736 100644 --- a/CRToast/CRToastViewController.m +++ b/CRToast/CRToastViewController.m @@ -37,6 +37,10 @@ - (BOOL)shouldAutorotate { return _autorotate; } +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + return UIInterfaceOrientationMaskAll; +} + - (BOOL)prefersStatusBarHidden { return [UIApplication sharedApplication].statusBarHidden; } diff --git a/Example/CRToastDemo.xcodeproj/project.pbxproj b/Example/CRToastDemo.xcodeproj/project.pbxproj index d291e72d..94912369 100644 --- a/Example/CRToastDemo.xcodeproj/project.pbxproj +++ b/Example/CRToastDemo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 307C71BC1D3CA6C200CE2EDC /* UINavigationControllerWIthUpsideDownSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 307C71BB1D3CA6C200CE2EDC /* UINavigationControllerWIthUpsideDownSupport.m */; }; 464D04F01BD2258200E0E90A /* CRToast.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 464D04E61BD2248100E0E90A /* CRToast.framework */; }; 464D04F11BD2258200E0E90A /* CRToast.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 464D04E61BD2248100E0E90A /* CRToast.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 5E2FFB5718367C01003333F8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E2FFB5618367C01003333F8 /* Foundation.framework */; }; @@ -66,6 +67,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 307C71BA1D3CA6C200CE2EDC /* UINavigationControllerWIthUpsideDownSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINavigationControllerWIthUpsideDownSupport.h; sourceTree = ""; }; + 307C71BB1D3CA6C200CE2EDC /* UINavigationControllerWIthUpsideDownSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINavigationControllerWIthUpsideDownSupport.m; sourceTree = ""; }; 464D04DF1BD2248100E0E90A /* CRToast.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CRToast.xcodeproj; path = ../CRToast.xcodeproj; sourceTree = ""; }; 5E2FFB5318367C01003333F8 /* CRToastDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CRToastDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5E2FFB5618367C01003333F8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -148,6 +151,8 @@ 5E2FFB8D18367CA3003333F8 /* MainViewController.xib */, 5E2FFB6818367C01003333F8 /* Images.xcassets */, 5E2FFB5D18367C01003333F8 /* Supporting Files */, + 307C71BA1D3CA6C200CE2EDC /* UINavigationControllerWIthUpsideDownSupport.h */, + 307C71BB1D3CA6C200CE2EDC /* UINavigationControllerWIthUpsideDownSupport.m */, ); path = CRToastDemo; sourceTree = ""; @@ -193,11 +198,6 @@ attributes = { LastUpgradeCheck = 0700; ORGANIZATIONNAME = "Collin Ruffenach"; - TargetAttributes = { - 5E2FFB5218367C01003333F8 = { - DevelopmentTeam = 7AM27DZVQU; - }; - }; }; buildConfigurationList = 5E2FFB4E18367C01003333F8 /* Build configuration list for PBXProject "CRToastDemo" */; compatibilityVersion = "Xcode 3.2"; @@ -265,6 +265,7 @@ buildActionMask = 2147483647; files = ( 5E2FFB6718367C01003333F8 /* AppDelegate.m in Sources */, + 307C71BC1D3CA6C200CE2EDC /* UINavigationControllerWIthUpsideDownSupport.m in Sources */, 5E2FFB6318367C01003333F8 /* main.m in Sources */, 5E2FFB8E18367CA3003333F8 /* MainViewController.m in Sources */, ); diff --git a/Example/CRToastDemo/AppDelegate.m b/Example/CRToastDemo/AppDelegate.m index 8a643dcc..085ca0ce 100644 --- a/Example/CRToastDemo/AppDelegate.m +++ b/Example/CRToastDemo/AppDelegate.m @@ -5,6 +5,7 @@ #import "AppDelegate.h" #import "MainViewController.h" +#import "UINavigationControllerWIthUpsideDownSupport.h" #import @implementation AppDelegate @@ -18,7 +19,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; - UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:[[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil]]; + UINavigationController *navigationController = [[UINavigationControllerWIthUpsideDownSupport alloc] initWithRootViewController:[[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil]]; self.window.rootViewController = navigationController; [self.window makeKeyAndVisible]; return YES; diff --git a/Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.h b/Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.h new file mode 100644 index 00000000..61d5024d --- /dev/null +++ b/Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.h @@ -0,0 +1,13 @@ +// +// UINavigationControllerWIthUpsideDownSupport.h +// CRToastDemo +// +// Created by Michael Hansen on 18/07/2016. +// Copyright © 2016 Collin Ruffenach. All rights reserved. +// + +#import + +@interface UINavigationControllerWIthUpsideDownSupport : UINavigationController + +@end diff --git a/Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.m b/Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.m new file mode 100644 index 00000000..0afff764 --- /dev/null +++ b/Example/CRToastDemo/UINavigationControllerWIthUpsideDownSupport.m @@ -0,0 +1,17 @@ +// +// UINavigationControllerWIthUpsideDownSupport.m +// CRToastDemo +// +// Created by Michael Hansen on 18/07/2016. +// Copyright © 2016 Collin Ruffenach. All rights reserved. +// + +#import "UINavigationControllerWIthUpsideDownSupport.h" + +@implementation UINavigationControllerWIthUpsideDownSupport + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + return UIInterfaceOrientationMaskAll; +} + +@end