在swift中
!tempPlays.values.contains(1)
目标C
(![[tempPlays objectForKey:@"1"] integerValue]) // tempPlays is NSDictionary
也可以帮忙吗?
IN SWIFT
button0.setTitle(plays[0] == 0 ? "O": (plays[0] == 1 ? "X" : button0.titleLabel!.text!), forState: UIControlState.Normal)`
IN OBJECTIVE C
[_btn0 setTitle:([[playDictionary objectForKey:@"0"]integerValue] == 0 ? @"O" : ([[playDictionary objectForKey:@"0"]integerValue] == 1 ? @"X" : _btn0.titleLabel.text)) forState:UIControlStateNormal];`
iOS新手..
答案 0 :(得分:0)
在Objective-C
中 if (![tempPlays.allValues containsObject:@"1"]) {}
或
if (![tempPlays.allValues containsObject:@(1)]) {}
添加案例
NSString *titleBtn = _btn0.titleLabel.text;
if ([playDictionary[@"0"] integerValue] == 0) {
titleBtn = @"0";
}
else if ([playDictionary[@"1"] integerValue] == 1){
titleBtn = @"X";
}
[_btn0 setTitle:titleBtn forState:UIControlStateNormal];