Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何延迟弹出页面?_Ios - Fatal编程技术网

Ios 如何延迟弹出页面?

Ios 如何延迟弹出页面?,ios,Ios,我刚刚在Xcode中构建了一个活动指示器视图和一个弹出页面。如何在活动指示器视图中获得3秒延迟,然后切换到弹出页面 这是我的Viewcontroller.m - (IBAction)Connect:(UIButton *)sender forEvent:(UIEvent *)event { [self performSelector:@selector(delay2) withObject:Nil afterDelay:6.0]; [self performSelector:@sele

我刚刚在Xcode中构建了一个活动指示器视图和一个弹出页面。如何在活动指示器视图中获得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 {

}

什么是连接行为?你想跳到哪一页?你设置好了吗?是的,我已经发出了UIAlert,但是活动指示器视图同时显示,没有延迟6秒…非常感谢~~成功了!!还有一个问题,很抱歉,在我的情况下,活动指示器视图怎么能忽略?非常感谢~ ConnectAct是活动指示器吗?你能展示更多关于它的代码吗?请尝试[ConnectAct setHidden:YES]或[ConnectAct stopAnimating]。您应该详细阅读apple开发者文档。我已经使用了ConnectAct.stopAnimating,它工作了,但我得到了一个黄色的平面,它告诉我属性访问结果未使用-getter不应该用于副作用,我错了什么?谢谢~把圆点去掉。dot表示访问该属性。请仔细查看我的评论。只是解决了问题,我忘记在那里添加[]了~非常感谢~但又出现了一个新问题~很抱歉有很多问题,在第一次运行活动指示器并将其关闭后,当我再次按下按钮时,它将继续关闭,并且不再显示。。ddi如果需要,我需要用它吗?谢谢~
- (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];
}