This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func currentController() -> UIViewController? { | |
if self.pageViewController?.viewControllers?.count > 0 { | |
return self.pageViewController?.viewControllers![0] | |
} | |
return nil | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func currentControllerIndex() -> Int { | |
let pageItemController = self.currentController() | |
if let controller = pageItemController as? PageItemController { | |
return controller.itemIndex | |
} | |
return -1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSUInteger)currentControllerIndex | |
{ | |
PageItemController *pageItemController = (PageItemController *) [self currentController]; | |
if (pageItemController) | |
{ | |
return pageItemController.itemIndex; | |
} | |
return -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface RadiosPreferences : NSObject | |
@property (nonatomic) BOOL airplaneMode; | |
- (void)synchronize; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | |
{ | |
if ([self.window.rootViewController.presentedViewController isKindOfClass:[SecondViewController class]]) | |
{ | |
return UIInterfaceOrientationMaskAll; | |
} | |
else return UIInterfaceOrientationMaskPortrait; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask { | |
if self.window?.rootViewController?.presentedViewController is SecondViewController { | |
return UIInterfaceOrientationMask.All; | |
} else { | |
return UIInterfaceOrientationMask.Portrait; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface SecondViewController () | |
@property (nonatomic) BOOL isPresented; // This property is very important | |
@end | |
@implementation SecondViewController | |
- (void)viewDidLoad | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SecondViewController: UIViewController { | |
var isPresented = true // This property is very important, set it to true initially | |
@IBAction | |
func dismiss() { | |
isPresented = false // Set this flag to NO before dismissing controller, so that correct orientation will be chosen for the bottom controller | |
self.presentingViewController!.dismissViewControllerAnimated(true, completion: nil); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | |
{ | |
if ([self.window.rootViewController.presentedViewController isKindOfClass:[SecondViewController class]]) | |
{ | |
SecondViewController *secondController = (SecondViewController *) self.window.rootViewController.presentedViewController; | |
if (secondController.isPresented) // Check current controller state | |
{ | |
return UIInterfaceOrientationMaskAll; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask { | |
if self.window?.rootViewController?.presentedViewController is SecondViewController { | |
let secondController = self.window!.rootViewController!.presentedViewController as! SecondViewController | |
if secondController.isPresented { // Check current controller state | |
return UIInterfaceOrientationMask.All; | |
} else { | |
return UIInterfaceOrientationMask.Portrait; |