-(Ibaction) Action: (ID) Sender {
NSLog (@ "begin%@", [NSDate Date]);
NSDate * begin =[nsdate Date];
NSData * dat =[nsdata datawithcontentsofurl:[nsurl urlwithstring:@ "http://img.tuku.cn/file_thumb/201501/ M2015013000131833.jpg "];
Self.imageview.image=[uiimage Imagewithdata:dat];
NSLog (@ "endn%@", [NSDate Date]);
NSDate * end =[nsdate Date];
NSLog (@ "%f", [end Timeintervalsincedate:begin]);
Cftimeinterval start =cfabsolutetimegetcurrent ();
[Self Performselectorinbackground: @selector (down) withobject:nil];
}
-(void) down
{
NSData * dat =[nsdata datawithcontentsofurl:[nsurl urlwithstring:@ "http://b.hiphotos.baidu.com/zhidao/pic/item/ 1e30e924b899a9010d59b4f31f950a7b0308f583.jpg "];
NSLog (@ "%@", [Nsthread CurrentThread]);
uiimage* Image=[uiimage Imagewithdata:dat];
Back to main thread
[Self.imageview performselectoronmainthread: @selector (setimage:) withobject:image Waituntildone:no];
[Self.imageview performselector: @selector (setimage:) onthread:[nsthread Mainthread] Withobject:image waitUntilDone: NO];
}
Communication between threads