Reputation: 273
I'm trying to set the layer properties of multiple buttons connected to an IBOutletCollectio
n but the IBOutletCollection
doesn't let me access UIButton.layer
the same as it does for a regular IBOutlet
.
Interface file:
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *customButton;
@property (weak, nonatomic) IBOutlet UIButton *myButton;
Implementation file
myButton.layer.cornerRadius = 9; // this works for individual buttons
customButton.layer.cornerRadius = 9; //This doesn't work for the collection of buttons
Am I missing something? Do I need to do something else to adjust the layer properties of a collection? I've imported QuartzCore into my implementation file.
I'm only trying to add 4 buttons to the collection so its not the end of the world if I have to set each on independently but it would be nice to be able to set them up together.
Upvotes: 2
Views: 404
Reputation: 20021
customButton is an NSArray.It doesnt have the layer as property.
Use this
for (UIButton *button in customButton) {
button.layer.cornerRadius = 9;
}
Upvotes: 5