This file contains 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 "MyCustomSegue.h" | |
@implementation MyCustomSegue | |
- (void)perform | |
{ | |
UIView *sourceView = ((UIViewController *)self.sourceViewController).view; | |
UIView *destinationView = ((UIViewController *)self.destinationViewController).view; | |
This file contains 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)perform | |
{ | |
UIView *sourceView = ((UIViewController *)self.sourceViewController).view; | |
UIView *destinationView = ((UIViewController *)self.destinationViewController).view; | |
UIWindow *window = [[[UIApplication sharedApplication] delegate] window]; | |
destinationView.center = CGPointMake(sourceView.center.x, sourceView.center.y - destinationView.center.y); | |
[window insertSubview:destinationView aboveSubview:sourceView]; | |
This file contains 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
//in MyCustomUnwindSegue.m | |
// 1. beloveSubview | |
[window insertSubview:destinationView belowSubview:sourceView]; | |
// instead of aboveSubview | |
[window insertSubview:destinationView aboveSubview:sourceView]; |
This file contains 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 "MyCustomUnwindSegue.h" | |
@implementation MyCustomUnwindSegue | |
- (void)perform | |
{ | |
UIView *sourceView = ((UIViewController *)self.sourceViewController).view; | |
UIView *destinationView = ((UIViewController *)self.destinationViewController).view; | |
This file contains 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 "MyCustomUnwindSegue.h" | |
@implementation MyCustomUnwindSegue | |
- (void)perform | |
{ | |
UIView *sourceView = ((UIViewController *)self.sourceViewController).view; | |
UIView *destinationView = ((UIViewController *)self.destinationViewController).view; | |
This file contains 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)returnedFromSegue:(UIStoryboardSegue *)segue { | |
NSLog(@"Returned from second view"); | |
if ([[segue identifier] isEqualToString:@"UnwindFromSecondView"]) { | |
self.view.backgroundColor = [UIColor orangeColor]; | |
} | |
This file contains 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
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier | |
{ | |
//how to set identifier for an unwind segue: | |
//1. in storyboard -> documento outline -> select your unwind segue | |
//2. then choose attribute inspector and insert the identifier name | |
if ([@"UnwindFromSecondView" isEqualToString:identifier]) { | |
return [[MyCustomUnwindSegue alloc] initWithIdentifier:identifier source:fromViewController destination:toViewController]; | |
}else { |
This file contains 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 "MyNavController.h" | |
#import "MyCustomUnwindSegue.h" | |
@interface MyNavController () | |
@end | |
@implementation MyNavController | |
- (void)viewDidLoad { |
This file contains 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
@implementation ViewController | |
@synthesize TextField1, TextField2; | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
self.TextField1.placeholder = @"I am TF 1"; | |
self.TextField2.placeholder = @"I am TF 2"; | |
} |
This file contains 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)textFieldDidBeginEditing:(UITextField *)textField { | |
// When start to edit the placeholder will disappear | |
self.TextField1.placeholder = @""; | |
self.TextField2.placeholder = @""; | |
} | |
- (void)textFieldDidEndEditing:(UITextField *)textField { |
OlderNewer