[ios]NSThread传值 NSValue传值

NSThread:http://www.cocoachina.com/bbs/read.php?tid=51873

NSValue:http://blog.sina.com.cn/s/blog_bf9843bf0101ehs1.html

//NSThread 属于 Foundation框架
-(void)startThread { MYClass c1(1,2,3); typedef struct _MyP { MYClass c1; int i; }MYP; MYP mp; pp.c1 = c1; pp.i = 10; //NSThread 传值 //NSValue 传值 [NSThread detachNewThreadSelector:@selector(FuncFrom:To:) toTarget:self withObject:[NSValue valueWithBytes:&mp objCType:@encode(MYP)]]; } -(void)FuncFrom:(MYClass)mc To:(int)value { .... }
原文地址:https://www.cnblogs.com/lyggqm/p/4894309.html