在我的应用程序来当我运行定时器时按下按钮,取得按钮标签名“空”,从背景的委托方法
我想运行在背景和定时器时让我用这个方法,
- (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); 我得到空值?
出了什么问题?
释放的对象。 –