2010-09-06 39 views
1

請參閱下面的代碼,如何將ID比較在iPhone

-(void) dataFromURL:(NSString *)url withRef:(id)ref 
{ 

if([email protected]"Category") 
    Printf("category");  //I need control here but control doesn't come here.<br> 
else 
    printf("Subcategory"); 

} 

如何,我將ID數據類型(REF)比較像類別的值?當我通過NSLog(@"ID %@",ref);打印參考時它返回爲類別:0xd28f50在尖括號中。

回答

0

它很簡單.....我知道了 [ref isKindOfClass:[Category class]]。

:)