Last active
August 29, 2015 14:21
-
-
Save D-32/c141c4a04ce72cc74237 to your computer and use it in GitHub Desktop.
Revisions
-
D-32 revised this gist
Aug 6, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,7 @@ static CGFloat kHeight = 480; _container = [[UIView alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height / 2, self.view.frame.size.width - 40, 0)]; _container.backgroundColor = [UIColor whiteColor]; _container.layer.cornerRadius = 6; _container.clipsToBounds = YES; [self.view addSubview:_container]; } -
D-32 revised this gist
Aug 6, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ static CGFloat kHeight = 480; @implementation ModalViewController { UIView *_bg; UIView *_container; @@ -32,8 +34,8 @@ [UIView animateWithDuration:0.3 animations:^{ _bg.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.7]; CGRect f = _container.frame; f.origin.y = self.view.frame.size.height / 2 - kHeight / 2; f.size.height = kHeight; _container.frame = f; }]; } -
D-32 created this gist
May 13, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ @implementation ModalViewController { UIView *_bg; UIView *_container; } - (instancetype)init { if (self = [super init]) { self.providesPresentationContextTransitionStyle = YES; self.definesPresentationContext = YES; self.modalPresentationStyle = UIModalPresentationOverCurrentContext; } return self; } - (void)viewDidLoad { [super viewDidLoad]; _bg = [[UIView alloc] initWithFrame:self.view.bounds]; _bg.backgroundColor = [UIColor clearColor]; [_bg addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(close)]]; [self.view addSubview:_bg]; _container = [[UIView alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height / 2, self.view.frame.size.width - 40, 0)]; _container.backgroundColor = [UIColor whiteColor]; _container.layer.cornerRadius = 6; [self.view addSubview:_container]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [UIView animateWithDuration:0.3 animations:^{ _bg.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.7]; CGRect f = _container.frame; f.origin.y = self.view.frame.size.height / 2 - 240; f.size.height = 480; _container.frame = f; }]; } - (void)close { [UIView animateWithDuration:0.3 animations:^{ _bg.backgroundColor = [UIColor clearColor]; CGRect f = _container.frame; f.origin.y = self.view.frame.size.height; _container.frame = f; } completion:^(BOOL finished) { [self dismissViewControllerAnimated:NO completion:nil]; }]; }