我想构建对象,然后用它打开一个 Controller 。构建最多可能需要 5 秒,我想在处理过程中显示一条消息。
我有以下 didSelectRowAtIndexPath
的实现:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
messageView.hidden = NO;
// Some methods
Controller *ctrl = [Controller new];
[self.navigationController pushViewController:ctrl animated:YES];
}
一切都很好,但有一个问题:messageView
仅在推送动画开始时出现。我该怎么做才能解决这个问题?
最佳答案
与 Jonathan 的回答类似,稍微延迟推送,让 messageView 有时间出现。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
messageView.hidden = NO;
int64_t oneMillisecond = NSEC_PER_MSEC;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, oneMillisecond), dispatch_get_main_queue(), ^(void){
// Some methods
Controller *ctrl = [Controller new];
[self.navigationController pushViewController:ctrl animated:YES];
});
}
关于iphone - 直到 pushViewController 才应用外观更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11300138/