문제

I have a UIViewController with IBOutletCollection of UIButtons. The thing I'm trying to get is to have several view controllers with only difference is the amount of same buttons in the outlet collection. What is the correct way to implement that? Assume that layouts of view controllers could be designed in storyboard.

How should I do that? Thank you.

도움이 되었습니까?

해결책

Something like this you can't do it storyboard. Create a UIViewcontroller with a method.

- (instancetype)initWithButton:(NSArray*)buttonsArray
{
    self = [super init];
    if (self) {
        self.buttonsArray = buttonsArray;
    }
    return self;
}

-(void)viewDidLoad{
 // add buttons to root view here
}

Now create instances of this viewcontrollers with different buttons array.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top