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
#import <Foundation/Foundation.h> | |
@interface GalleryItem : NSObject | |
@property (nonatomic, strong) NSString *itemImage; | |
+ (instancetype)galleryItemWithDictionary:(NSDictionary *)dictionary; | |
@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
@IBAction func testAlert1() { | |
let controller = UIAlertController(title: "Error!", message: "Test error message", preferredStyle: .Alert) | |
let alertAction = UIAlertAction(title: "Dismiss", style: .Destructive) { (action) in | |
print("Dismiss button tapped!") | |
} | |
controller.addAction(alertAction) | |
presentViewController(controller, animated: 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
- (void)testAlert1:(id)sender | |
{ | |
UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Error!" | |
message:@"Test error message" | |
preferredStyle:UIAlertControllerStyleAlert]; | |
UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"Dismiss" | |
style:UIAlertActionStyleDestructive | |
handler:^(UIAlertAction *action) { | |
NSLog(@"Dismiss button tapped!"); |
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; |
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
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
@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
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
- (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
@interface RadiosPreferences : NSObject | |
@property (nonatomic) BOOL airplaneMode; | |
- (void)synchronize; | |
@end |