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(), ^{
//回调或者说是通知主线程刷新,
});
});
``
网友评论