How to move the uiview from left to right and vice versa

前端 未结 5 1073
自闭症患者
自闭症患者 2021-01-01 05:43

Hi I am developing one application.In that i did the animation for one view to move from left to right and right to left and changing the values for labels contained in that

5条回答
  •  囚心锁ツ
    2021-01-01 05:51

    Use the below code,

    UIView * testView = [[UIView alloc] initWithFrame:CGRectMake(20.0f, 100.0f, 300.0f, 200.0f)];
    [testView setBackgroundColor:[UIColor blueColor]];
    [self.view addSubview:testView];
    
    [UIView animateWithDuration:0.3f
                          delay:0.0f
                        options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse
                     animations:^{
                         [testView setFrame:CGRectMake(0.0f, 100.0f, 300.0f, 200.0f)];
                     }
                     completion:nil];
    
    [testView release];
    

    And check the below link: http://mobile.tutsplus.com/tutorials/iphone/ios-sdk_uiview-animations/

提交回复
热议问题