Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能得到一个id类型属于哪个类型。并取决于类型来做不同的方法
-(id)initWithImage:(id)texture { if(texure == NSString) { do fun1; } if(texture == NSMutableArray) { do fun2; } }
[texture isMemberOfClass: [NSString class]]
(或者 isKindOfClass 如果您也想为子类返回 YES)