I am having some trouble getting my head around how I can init a class and pass identical init params to multiple instances. I can get it to work with 1 outlet (instance1). But how can I also get it to work with instance 2 without re-writing the variables for each instance?
ViewController.h:
#import "CustomClass.h"
@interface MYViewController : UIViewController
@property (unsafe_unretained, nonatomic) IBOutlet CustomClass *instance1;
@property (unsafe_unretained, nonatomic) IBOutlet CustomClass *instance2;
@end
ViewController.m:
#import "CustomClass.h"
@implementation MYViewController;
@synthesize instance1, instance2;
- (void)viewDidLoad
{
[super viewDidLoad];
instance1.variable1 = option1;
instance1.variable2 = 4.5;
instance1.variable3 = instance1.value;
[instance1 addTarget:self action:@selector(instance1DidChange) forControlEvents:UIControlEventValueChanged];
A loop with some KVC should do it for you…
Should be pretty close to what you’re looking for.