Basically, I have a view that can have an unlimited amount of UIView inside. I want to be able to set self.numberOfSections = 8
or self.numberOfSections = 2
, and then create the same amount UIImages
, generated accordingly, that can be processed.
Currently, I have many images IBInspectible
in my code that appear regardless of whether I have 2 numberOfSections or 100 numberOfSections. I would like to somehow create UIImages
, based on my numberOfSections number.


If I set Number of Sections to 2 here, I can set the images in the story panel, but all other IBInspectable elements will also be displayed, because there are only 2 sections. Is there a way to get only those that are needed? I want to set the images in a storyboard. Is there a way to reorganize this so that there are not so many IBInspectables?
This is how I set images to various programmatically generated views in code.
-(void)drawRect:(CGRect)rect
for (int i = 0; i < self.numberOfSections; i++) {
NSString *rotaryName = [NSString stringWithFormat:@"rotaryImage%d", i + 1];
id rotaryNameValue = [self valueForKey:rotaryName];
[self.sectorView setValue:rotaryNameValue forKey:@"image"];
}
}
source
share