在视图之间移动

时间:2014-03-17 12:05:52

标签: ios objective-c

我在这样的故事板中的视图之间移动:

  [self performSegueWithIdentifier:@"Next" sender:self];

它有效,它移动到第二个视图。在第二类我已经声明了一个计时器,当第二个视图加载它开始运行时它开始移动一些对象。也工作正常,但它开始移动对象两秒钟,而不是将对象移回原始位置并开始再次移动它们。在运行之后就好了。当我移动到那个视图时,我不知道为什么它会第一次重启它?

(secondClass.m file)

- (void)viewDidLoad
 {
   [super viewDidLoad]
   move=[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(moveObject) userInfo:nil repeats:YES];

 }

-(void)moveObject
 {
   obj1.center = CGPointMake(obj1.center.x-1, obj.center.y);
 }

0 个答案:

没有答案
相关问题