[英]Compare a enum type in a If
我在比較枚舉類型時遇到問題。
這是我的枚舉:
enum typeson {folder, service};
enum typeson *type;
我的類上有一個方法可以返回方法類型。
-(void) setType: (enum typeson) t;
-(enum typeson) getType;
如果我這樣做,它將起作用:
NSLog(@"Object type: %d", [[[actualNode sons] objectAtIndex:indexPath.row] getType]);
返回1或0取決於類型。 問題是當我這樣做時:
if (![[[actualNode sons] objectAtIndex:indexPath.row] getType]==service) {
NSLog(@"This is a service type");
}
沒用 我試圖將“服務”更改為1,“ 1” ...什么也沒有發生。 謝謝
// this ! probably shouldn't be there.
// v
if (![[[actualNode sons] objectAtIndex:indexPath.row] getType]==service) {
NSLog(@"This is a service type");
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.