美文网首页
ios push到含有textview的界面,导航过程会发生卡顿

ios push到含有textview的界面,导航过程会发生卡顿

作者: b82e0191c0fe | 来源:发表于2016-08-23 16:15 被阅读74次

1.在app delegate中初始化一个无用的textview;

2.在子线程程中初始化textview,但是textview的显示会延迟

dispatch_async(dispatch_get_global_queue(0, 0), ^{
        // 处理耗时操作的代码块...
        UITextView * textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 160)];
        textView.layer.borderColor = [UIColor blackColor].CGColor;
        textView.layer.borderWidth = 5;
        textView.delegate = self;
        //通知主线程刷新
        dispatch_async(dispatch_get_main_queue(), ^{
            //回调或者说是通知主线程刷新,
        });  
    });
``

相关文章

网友评论

      本文标题:ios push到含有textview的界面,导航过程会发生卡顿

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