ViewController.m#
//
// ViewController.m
// 多线程--NSObject
//
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//----------------------多线程NSObject---------------------------
//子线程:
[self performSelectorInBackground:@selector(mutableThread:) withObject:@"didididididi"];
//主线程:
for (int i = 0; i < 50; i ++) {
NSLog(@"主线程:%d", i);
}
}
//子线程调用方法
-(void)mutableThread:(NSString *)str{
for (int i = 0; i < 50; i ++) {
NSLog(@"子线程:%d", i);
}
NSLog(@"%@",str);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end