0

I'm trying to set localization strings for UIButton in interface builder, so I did the following :

1- Create a category to add the needed function:

.h

@interface UIButton (Localization)

- (void)setLocalizeKey:(NSString *)key;

@end

.m

#import "UIButton+Localization.h"

@implementation UIButton (Localization)

- (void)setLocalizeKey:(NSString *)key {
    [self setTitle:NSLocalizedString(key, nil) forState:UIControlStateNormal];
}

@end

2- use the property in interface builder

enter image description here

Now when I run the project I got the following error!:

Failed to set (localizeKey) user defined inspected property on (UIButton): [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key localizeKey.

What is the problem??

OXXY
  • 1,047
  • 2
  • 18
  • 43

0 Answers0