更新时间:2023-01-29 15:33:52
在有一系列对象(例如您的示例)的情况下,应将其添加到数组中并测试其在数组中的存在:
In a situation where you have a series of objects such as your example, you would add then to an array and test its existence in the array:
示例
NSMutableArray *arr = [[[NSMutableArray alloc] init] autorelease];
[arr addObject:@"First"];
[arr addObject:@"Second"];
[arr addObject:@"Third"];
if ([arr containsObject:textField.text])
{
// do something
}