私は xcode が初めてで、毎日何か新しいことを学んでいます。2 番目のストーリーボード (MapTwoViewController) にカスタム ボタンを作成したいのですが、それが雲のように見えるカスタム ボタンで、左から右に移動するとします。
ストーリーボードにカスタム ボタンを作成し、GWSMapTwoViewController.h に IBOutlet を作成したので、次のようになり、ボタンにリンクされます。
#import <UIKit/UIKit.h>
@interface GWSMapTwoViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIButton *cloudAnimate;
@end
したがって、ビューの GWSMapTwoViewController.m にロードされたのは次のとおりです。
#import "GWSMapTwoViewController.h"
@interface GWSMapTwoViewController ()
@end
@implementation GWSMapTwoViewController
@synthesize cloudAnimate;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Move UIView
cloudAnimate.center = CGPointMake(200.0, 100.0);
[UIView animateWithDuration:2.0 animations:^{ cloudAnimate.center = CGPointMake(100.0, 200.0);}];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
アニメーション化したくないだけで、エンドポイントにまっすぐ進みます。アニメーションコードを削除すると、雲は200、100に表示されますが、アニメーションコードを入れると、100、200、またはその他の座標に移動します入れました。アニメーション化しないので、開始点または終了点のいずれかにあります。
私が間違っていることを誰かに教えてもらえますか?