29 }
30
31
NSMutableArray
*arrTime=[[NSMutableArray
alloc]initWithObjects:@"1",@"2",@"2.5",@"3",@"3.5",@"4",@"4.5",@"5",@"5.5" ,nil];
32 int m = [arrTime count];
33 while(--m > 0) {
34 int n = rand()%(m+1);
35 [arrTime exchangeObjectAtIndex:m withObjectAtIndex:n];
36 }
37 [UIView beginAnimations:@"moive" context:nil];
38 for (int i=0; i<[arr count]; i++) {
39 [UIView setAnimationDuration:[[arrTime objectAtIndex:i] intValue]];
40 [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
41 //Make the animatable changes.
42 [[arr objectAtIndex:i]setAlpha:1];
43 }
44 [UIView commitAnimations];
45 [super viewDidAppear:animated];
46 }
复制代码
47 /CATransition
48 // 请自行导入框架和头文件。
49 - (void)viewDidAppear:(BOOL)animated
50 {
51
52
53
NSMutableArray
*
arr
=[[NSMutableArray
alloc]initWithObjects:@"2.jpg",@"1.jpg",@"4.jpg",@"3.jpg" ,nil];
54 int k = [arr count];
55 while(--k > 0) {
56 int j = rand()%(k+1);
57 [arr exchangeObjectAtIndex:k withObjectAtIndex:j];
58 }
59
60
61 float offset = 10;
62 int cellPadingY=10;
63 for (int i = 0; i < [arr count]; i++)
64 {
65 CGRect rect = CGRectMake(offset, cellPadingY, 90, 90);
66 button = [[UIButton alloc]initWithFrame:rect];