- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
背景
单击单元格时,我会向 HUD 显示“正在连接...”,当它验证时,推送到下一页。
问题:HUD 没有立即显示,而是在推送到下一个 View 之前显示。为了以防万一,尝试了各种不同的 HUD,但都失败了。我确定这不是 HUD。
问题:如何在单击单元格时立即启动 HUD? shouldPerformSegueWithIdentifier 是开始显示 HUD 的正确位置吗?我尝试使用 dispatch_async 或 sync,但我必须返回 YES/NO 来确定是否应该执行 segue。
-(BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender
{
if([identifier isEqual:@"ConnectServer"])
{
self.HUD = self.prototypeHUD;
self.HUD.textLabel.text = @"Connecting...";
[self.HUD showInView:self.navigationController.view];
NSManagedObject *obj = self.serverList[[self.tableView indexPathForSelectedRow].row];
return [self checkServerConnection:obj];
}
}
最佳答案
您可以通过 UITableViewDelegate
协议(protocol)实现 tableView:didSelectRowAtIndexPath:
。当用户点击单元格时,会立即调用此方法。然后,您必须检查此单元格是否应触发您的 HUD(假设您有不同种类的单元格,否则您可以省略检查)。
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (<check if the appropriate cell was tapped>) {
self.HUD = self.prototypeHUD;
self.HUD.textLabel.text = @"Connecting...";
[self.HUD showInView:self.navigationController.view];
}
}
关于ios - 如何使用 shouldPerformSegueWithIdentifier 在正确的时间显示 HUD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29003961/
我正在尝试进行 segue,但我有一个小问题,即我正在单击一个按钮,如果 bool 值为 YES,它将在 segue 中返回 YES,否则返回 NO,但每次我都必须单击两次检查文本字段,因为它首先传递
在 WatchKit 扩展中是否有一种名为“shouldperformseguewithidentifier”的方法或类似的方法?这是因为我需要在推送到另一个 View 之前进行检查。 最佳答案 在
我试图在发生转折之前提示警报并请求为我的应用程序中的高级功能付费,但 shouldPerformSegue 似乎不起作用。我有一个 SWRevealViewController 打开一个侧边菜单,我从
我正在制作一个非常基本的应用程序,它有一个搜索字段来获取传递给 tableview 的数据。 我想做的是运行一个异步任务来获取数据,如果数据成功获取,则转到下一个 View ,在加载期间屏幕不能卡住,
背景 导航 Controller View 带有包含 ftp 信息的单元格的表格 Cell segue 将连接到 ftp 服务器并显示列表 shouldPerformSegueWithIdentifi
我有一个检查登录是否正确的功能。如果没问题,我会显示下一个屏幕。如果用户不正确,我会取消 segue 并显示警报。 问题的出现是因为当我在shouldPerformSegueWithIdentifie
我有两个 View Controller 。在 View Controller 1 上,我有以下内容: 将我带到 viewcontroller2 的 segue - 这个 segue 被命名为“sho
我创建了一个推送序列并将标识符命名为“CustomIdentifier”之类的名称。用户注册成功后, shouldPerformSegueWithIdentifier 执行并推送到另一个 View C
我尝试在计时器完成后执行转场,但无法执行转场。 这是我的代码 var timer = NSTimer() @IBOutlet weak var imageView: UIImageView!
当我想从登录 View 转到应用程序的主视图时,我遇到了一些麻烦。问题是我必须点击登录按钮两次才能显示下一个 View 。 当我调试该函数时,Loginbool 在第一次单击时返回 false,但在第
我正在尝试执行 shouldPerformSegueWithIdentifier 并在 Controller 之间传递一些参数。 - (BOOL)shouldPerformSegueWithIdent
我有一个从点击按钮到 View Controller 的转折点。在包含按钮的 View Controller 的 swift 类中: override func shouldPerformSegueW
我正在尝试学习 Swift,我想做的是创建简单的登录页面。每当用户单击登录按钮时,我都会在 shouldPerformSegueWithIdentifier 中向我的 Web 服务发出请求,以检查用户
我正在尝试使用 swift 的 shouldPerformSegueWithIdentifier() 方法,但它接受 2 个参数。这些是(标识符:String!,发件人:AnyObject) 我的主要
我有一个从名为 DetailViewController 的 UIViewController 到 MainViewController 的展开转场,定义为(在 MainViewController
我需要验证凭据。因此,segue 在登录按钮中从第一个 View Controller 链接到第二个 View Controller 。当我在没有任何条件检查的情况下进行转场时。导航工作正常。 但是当
我是一名优秀的程序员,十分优秀!