IOS Interview Questions:

IOS Basic Interview Questions 1

IOS Interview Collection + Answer (1)

IOS Interview Collection + Answer (2)

IOS Interview Collection + Answer (3)

IOS Interview Collection + Answer (4)

IOS Interview Collection + Answers (5)

Common iOS Development Interview Questions

A learning route for iOS developers

Animation effect is one of the important features of IOS interface, among which CAAnimation is the abstract parent class of all animation objects. As a new person, I use animation methods (class methods) under UIView more. To use animations under UIView, there are several methods.

Method 1: Set beginAnimations

Where memberView is the view of the subview to be added, mivc.view is the subview, these two places need to be replaced when using

1.    [UIView beginAnimations:@"view flip" context:nil];
2.    [UIView setAnimationDuration:1];
3.    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:memberView cache:YES];
4.    [memberView addSubview:mivc.view];
5.    [UIView commitAnimations];
Copy the code

Be sure to use [UIView commitAnimations]; Animation will only take effect through [UIView setAnimationDuration:1]; Set the duration.

With IOS4.0, we have a new approach, + (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options Animations :(void (^)(void)) completion:(void (^)(BOOL finished))completion: animations:(void (^)(BOOL finished))completion: A Block object is a set of instructions that can be passed (like a variable). Think of it as a C function pointer.

Method 2:

In the current view, delete [blueViewController View], add [yellowViewController View], when using, these two places should be replaced

1. [UIView transitionWithView: self view 2. Duration: 3. 0.2 the options: UIViewAnimationOptionTransitionFlipFromLeft 4. animations:^{ [[blueViewController view] removeFromSuperview]; [[self view] insertSubview:yellowViewController.view atIndex:0]; } 5. completion:NULL];Copy the code

The block after animations: is the change to a particular view and cannot be NULL, while the block after Completion: is the block of code that needs to be executed after the animation has finished and can be NULL.

According to the manual, user interaction with this view is temporarily invalid during animation (whereas prior to IOS5.0, user interaction with the entire application was not valid during animation). If you want the user to interact with the view, Can change the value of the UIViewAnimationOptionAllowUserInteraction.