2012-07-31 69 views
0

如何制作将UIButton的属性从隐藏变为显示以及从显示变为隐藏的4个按钮之间交替的计时器?设置计时器以更改UIButton属性

我正在使用xCode 4.4

谢谢!

+0

[你有什么尝试?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – 2012-07-31 18:00:48

+0

我不知道该做什么,但我试过在触发事件中使用计时器,但即使这是正确的,我也不知道如何通过代码更改属性。 – Pablo 2012-07-31 18:09:20

+0

计时器: http://stackoverflow.com/questions/3519562/how-do-i-write-a-timer-in-objective-c 显示/隐藏: http://stackoverflow.com/questions/ 957821 /显示-或隐藏-A-的UIButton合iphone应用内与 - obejctive-C – Zac 2012-07-31 18:15:30

回答

0

NSTimer *aTimer = [NSTimer scheduledTimerWithTimeInterval: 2.0 
         target: self 
         selector:@selector(onTick:) 
         userInfo: nil repeats:YES]; 

而且,onTick方法应该是这样的

-(void)onTick:(NSTimer *)timer { 
    //This is where you need to set your button hidden property. 
} 

入住这link out.It的精心细致。