You can create a property called text in your custom UIView and then use User Runtime Attributes to change it.
In the Interface Builder you can have:
Then you can override in your CustomView:
// This method will get called for each attribute you define.
-(void) setValue:(id)value forKey:(NSString *)key {
if ([key isEqualToString:@"text"]) {
self.mylabel.text = value;
}
}
Note that you need to have your label in a property. @property (nonatomic, weak) UILabel* myLabel
So, when you setup your label you would need to :
-(void)setupLabel {
UILabel *label = [[UILabel alloc]init];
//...
[self addSubview:label];
//the label, since it is weak, needs to be added to the visual tree first
self.myLabel = label;
}