Created
August 23, 2014 15:19
-
-
Save g-1/b23c2c25707d94eb8dde to your computer and use it in GitHub Desktop.
iOSでポップアップビューの自作を行う。 ref: http://qiita.com/g-1/items/bbf785e32bdfb66eb714
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)close:(id)sender | |
{ | |
[UIView animateWithDuration:0.2f | |
animations:^{ | |
self.view.alpha = 0.2f; | |
} | |
completion:^(BOOL finished){ | |
[self.view removeFromSuperview]; | |
self.view.alpha = 1.f; | |
}]; | |
} |
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)popup:(id)sender | |
{ | |
[self.view addSubview:self.popupViewController.view]; | |
CGPoint center = self.popupViewController.contentView.center; | |
UIView* view = self.popupViewController.contentView; | |
view.transform = CGAffineTransformScale(CGAffineTransformIdentity,0.5f,0.5f); | |
view.center = center; | |
[UIView animateWithDuration:0.2 | |
delay:0.0 | |
options:UIViewAnimationOptionCurveEaseInOut | |
animations:^{ | |
view.transform = CGAffineTransformIdentity; | |
view.center = center; | |
} | |
completion:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment