移动UIView的方法

来源:互联网 发布:启发式算法的应用案例 编辑:程序博客网 时间:2024/05/17 20:25

方法1:

- (void) moveAlert: (UIAlertView *) alertView{    CGContextRef context = UIGraphicsGetCurrentContext();    NSLog(@"%@", context);        [UIView beginAnimations:nil context:context];        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];[UIView setAnimationDuration:0.25f];if (![self isLandscape])alertView.center = CGPointMake(160.0f, 180.0f);else alertView.center = CGPointMake(240.0f, 90.0f);[UIView commitAnimations];[[alertView viewWithTag:TEXT_FIELD_TAG] becomeFirstResponder];}


方法2:

- (void) moveAlert: (UIAlertView *) alertView{    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, -130.0);    [alertView setTransform:myTransform];}


0 0