contributors | originalUrl |
---|---|
antonio081014 |
- Create and Initialize new UIViewController
- Set
transitioningDelegate
to beself
- Set
modalPresentationStyle
to beUIModalPresentationCustom
- Call
- presentViewController:animated:completion:
- In this UIViewController, conforms to
UIViewControllerTransitioningDelegate
- Implement
- (id <UIViewControllerAnimatedTransitioning>) animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source
delegate method. In this method, we could totally customize the return object which conforms toUIViewControllerAnimatedTransitioning
. This delegate method give custom transition when trying to present a newUIViewController
. - Implement
- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
, In this method, we could also totally customize the return object which conforms toUIViewControllerAnimatedTransitioning
. This delegate method give custom transition when trying to dismiss a presentedUIViewController
. - Create a custom subclass of NSObject conforms to
UIViewControllerAnimatedTransitioning
, override several required methods, then magic happens.
UIAppearance
is very useful Protocol
in iOS system. Developer could use this protocol to customize all the UIView or UIControl in one action.
Example is like: [[UIButton appearance] setTintColor:[UIColor redColor]]
- [UIImage resizableImageWithCapInsets:]
The basics:
animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
gravityBehavior = [[UIGravityBehavior alloc] initWithItems:@[itemToAnimate]];
[animator addBehavior:gravityBehavior];