请参阅以下代码,
-(void) dataFromURL:(NSString *)url withRef:(id)ref
{
if(ref==@"Category")
Printf("category"); //I need control here but control doesn't come here.<br>
else
printf("Subcategory");
}
我如何将id数据类型(ref)与类似的值进行比较?当我通过NSLog(@"ID %@",ref);
打印参考时,它在角括号中以类别:0xd28f50 返回。
答案 0 :(得分:0)
它很简单......我明白了 [ref isKindOfClass:[Category class]]。
:)