I create a NSThread
to change the text of textField,and i make sure the NSThread
is not main thread.Though,the textField'text changed.Shouldn't the UI update must be on the main thread?
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(changeText) object:nil];
NSLog(@"%@ %d",thread,[thread isMainThread]);
[thread start];
}
- (void)changeText {
self.textField.text = @"this is thread";
}