我需要一个定时器,它被声明为NSTimer以消除警报。我在Vector.h(我的ViewController.h)中创建了所有neidend Filets。我很担心:
If(Timer == 35)
{Alert =[[ UIAlertView alloc] initWithTitle: @"end" Message: nil ....]}
Else
{
}
但它不起作用!请帮助!
笃
答案 0 :(得分:1)
如果我理解正确,你就会像我一样遇到山姆问题。你想在X秒后开始提醒,或者?你是这个意思吗?如果是,那么这是解决方案!关心朱利安!
在ViewController.M中执行此操作
-(IBAction)Start:(id)sender
{
Timer = [NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(alertStart) userInfo:nil repeats:NO];
}
-(void) alertStart
{
Alert = [[UIAlertView alloc]initWithTitle:@"end" message: nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles: nil];
// Above the Setup the Alert
[Alert show];
[Timer invalidate];
Timer = nil;
}