在我的應用程序來當我運行定時器時按下按鈕,取得按鈕標籤名「空」,從背景的委託方法
我想運行在背景和定時器時讓我用這個方法,
- (void)applicationWillEnterForeground:(UIApplication *)application
{
FirstViewController *view = [[FirstViewController alloc]init];
[view Startbtnpress]; //call the startbtnmethod
}
在Startbtnpress方法,
-(IBAction)Startbtnpress
{
NSLog(@"start.titleLabe:%@",start.titleLabel.text);
if([start.titleLabel.text isEqualToString:@"START"])
{
myticker = [NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(ShowActicity) userInfo:nil repeats:YES];
}
else if([start.titleLabel.text isEqualToString:@"STOP"]
{
[myticker invalidate];
}
}
當首次調用的NSLog啓動按鈕方法(@ 「start.titleLabe:%@」,start.titleLabel.text); 我得到的 「START」
當我通過
- (void)applicationWillEnterForeground:(UIApplication *)application
進來的NSLog(@ 「start.titleLabe:%@」,start.titleLabel.text); 我得到空值?
出了什麼問題?
釋放的對象。 –