我刚刚在Xcode中构建了一个Activity指示器视图和一个弹出页面。如何在活动指示器视图中获得3秒延迟,然后切换到弹出页面?
这是我的Viewcontroller.m
- (IBAction)Connect:(UIButton *)sender forEvent:(UIEvent *)event
{
[self performSelector:@selector(delay2) withObject:Nil afterDelay:6.0];
[self performSelector:@selector(delay1) withObject:ConnectAct afterDelay:0.0];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"LP01;" message:@"No Connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Help", nil];
[alert show];
}
- (IBAction)ConnectLP02:(UIButton *)sender
{
[self performSelector:@selector(delay2) withObject:Nil afterDelay:6.0];
[self performSelector:@selector(delay1) withObject:ConnectAct afterDelay:0.0];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"LP02;" message:@"No Connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Help", nil];
[alert show];
}
- (void)delay1 {
ConnectAct.alpha = 1.0;
}
- (void)delay2 {
}
答案 0 :(得分:0)
- (IBAction)ConnectLP02:(UIButton *)sender
{
[self performSelector:@selector(delay2) withObject:Nil afterDelay:6.0];
[self performSelector:@selector(delay1) withObject:ConnectAct afterDelay:0.0];
}
- (void)delay1 {
ConnectAct.alpha = 1.0;
}
- (void)delay2 {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"LP02;" message:@"No Connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Help", nil];
[alert show];
}