我有一个名为logoview的UIView。UIView animateWithDuration结果每次都在同一位置
[logoview setCenter:CGPointMake(100,100)];
[UIView animateWithDuration:4
delay:1
options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
animations:^{
[logoview setCenter:CGPointMake(0, 3232)];
}
completion:^(BOOL finished) {
}];
我正在尝试使用上面的代码对它进行设置。它会导致对象每次都从头到尾转向中心。无论我在动画部分中使用哪些线,我都使用故事板。
我的最终目标是简单地在中心显示徽标。然后像在Skype上一样提升徽标,并在Facebook登录中显示登录字段。然而,不管我输入什么值
[logoview setCenter:CGPointMake(0, 3232)];
它只是去中心。
我也只是尝试:
[UIView animateWithDuration:4
delay:1
options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
animations:^{
[logoview setTransform: CGAffineTransformMakeTranslation(0, -80)];
}
completion:^(BOOL finished) {
}];
其工作是解除logoview但同时也抵消了下来很有点...使其成为偏心。
整个.M
//
// ViewController.m
// Couple
//
// Created by Michael Latman on 4/1/13.
// Copyright (c) 2013 Michael Latman. All rights reserved.
//
#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad
{
//Rounded corners!
self.view.layer.cornerRadius = 10;
self.view.layer.masksToBounds = YES;
//lol.layer.cornerRadius = 90;
//lol.layer.masksToBounds = YES;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//[logoview setCenter:CGPointMake(100,100)];
[UIView animateWithDuration:4
delay:1
options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
animations:^{
[logoview setCenter:CGPointMake(0, 1)];
}
completion:^(BOOL finished) {
}];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
工作..感谢@matt太 – Michael