Code note: the animation is flipped when you click cell, and the cell animation is flipped.
I ,.
2. Engineering Drawing.
3. Code.
RootViewController. h
#import <UIKit/UIKit.h>@interface RootViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>{ UITableView *myTableView;}@end
RootViewController. m
# Import "RootViewController. h "@ interface RootViewController () @ end @ implementation RootViewController-(id) initWithNibName :( NSString *) bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization} return self;}-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // initialization background [self addView];} # pragma-mark-functions // initialization background-(void) addView {myTableView = [[UITableView alloc] initWithFrame: CGRectMake (0,100,320,300)]; myTableView. delegate = self; myTableView. dataSource = self; [self. view addSubview: myTableView];} # pragma-mark-UITableViewDelegate-(NSInteger) tableView :( UITableView *) tableView numberOfRowsInSection :( NSInteger) section {return 5;}-(NSInteger) numberOfSectionsInTableView :( UITableView *) tableView {return 1;}-(CGFloat) tableView :( UITableView *) tableView heightForRowAtIndexPath :( NSIndexPath *) indexPath {return 40 *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath {static NSString * CellIdentifier = @ "Cell"; UITableViewCell * cell = [tableView progress: CellIdentifier]; if (cell = nil) {cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier];} cell. textLabel. text = @ "1"; return cell;} // animation effect when clicked-(void) tableView :( UITableView *) tableView didSelectRowAtIndexPath :( NSIndexPath *) indexPath {[UIView beginAnimations: @ "animationID" context: nil]; [UIView setAnimationDuration: 0.5f]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; [UIView outputs: NO]; switch (indexPath. row) {case 0: [UIView setAnimationTransition: Rule forView: [tableView cellForRowAtIndexPath: indexPath] cache: YES]; break; case 1: [UIView setAnimationTransition: Rule forView: [tableView cellforrowatpath: indexPath] cache: YES]; break; case 2: [UIView setAnimationTransition: Rule forView: [tableView cellForRowAtIndexPath: indexPath] cache: YES]; break; case 3: [UIView setAnimationTransition: revoke forView: [tableView cellForRowAtIndexPath: indexPath] cache: YES]; break; default: break;} [UIView commitAnimations];}-(void) didreceivemorywarning {[super Resume]; // Dispose of any resources that can be recreated .}