Using makeObjectsPerformSelector:withObject: with a false boolean

前端 未结 3 1160
谎友^
谎友^ 2021-01-19 05:45

I\'ve got an array of UITextField objects called _fields. I want to be able to message them all at once to set them to be highlighted,

3条回答
  •  我在风中等你
    2021-01-19 06:03

    You should try using blocks because setHighlighted takes a BOOL as a parameter and not a pointer (NSNumber *) :

    [fields enumerateObjectsUsingBlock:^(UITextField *obj, NSUInteger idx, BOOL *stop) {
        obj.highlighted = YES; // or NO
    }];
    

提交回复
热议问题