美文网首页
presentViewController不弹出新视图问题

presentViewController不弹出新视图问题

作者: 俺妈说昵称越长媳妇越漂亮 | 来源:发表于2017-05-08 15:50 被阅读324次
我在tableView的didselect代理中选择了当前行,然后创建一个新视图控制器,并弹出
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        ShowImageController *showVC = [ShowImageController new];
        [self presentViewController:showVC animated:YES completion:nil];
}
然而,新视图并不会被弹出!
上网查了查发现,可能是执行的的线程问题,加上主线程执行即可!
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    dispatch_async(dispatch_get_main_queue(), ^{
        ShowImageController *showVC = [ShowImageController new];
        [self presentViewController:showVC animated:YES completion:nil];
    });
}
完美解决问题perfect.如果有其他的问题.持续更新谢谢

相关文章

网友评论

      本文标题:presentViewController不弹出新视图问题

      本文链接:https://www.haomeiwen.com/subject/miomtxtx.html