标签:style blog color os io ar div cti
#import "ViewController.h" @interface ViewController () { UIView *view; UIView *view0; int i; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; view=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 50, 50)]; view0=[[UIView alloc]initWithFrame:CGRectMake(200, 100, 50, 50)]; view.backgroundColor=[UIColor redColor]; view0.backgroundColor=[UIColor greenColor]; [self.view addSubview:view]; [self.view addSubview:view0]; [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(didclick:) userInfo:nil repeats:YES]; } - (IBAction)didclick:(id)sender { // [UIView animateWithDuration:5 delay:4 options: UIViewAnimationOptionCurveEaseInOut animations:^{} completion:(void (^)(BOOL finished))completion{ // }]; [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ NSLog(@"XXXXXXX"); if (i%2==0) {view.frame=CGRectMake(100, 100, 100, 100);} else { view0.frame=CGRectMake(200, 100, 100, 100); } } completion:^(BOOL finished) { NSLog(@"FINISH"); view.frame=CGRectMake(100, 100, 50, 50); view0.frame=CGRectMake(200, 100, 50, 50); i++; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
标签:style blog color os io ar div cti
原文地址:http://www.cnblogs.com/sunxiang1991/p/3925450.html