我有一个名为 logoview 的 UIView。
[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