Thursday, 22 August 2013

Getting data from another UIView subclass?

Getting data from another UIView subclass?

I have 2 UIView subclasses which are added in a UIViewController. 1 of the
subclasses sets an integer and when when an IBAction gets called the other
one should use it.
View1 .h:
#import <UIKit/UIKit.h>
@interface View1 : UIView
@property(nonatomic) int concentration;
View1 .m:
@synthesize concentration;
concentration = 10-stepper.value; // in an IBAction called by a UIStepper
View2 .h:
#import <UIKit/UIKit.h>
#import "View1.h"
@interface View2 : UIView {
View1 *options;
}
View2 .m:
options = [[View1 alloc] init];
NSLog(@"%i", options.concentration); // always return 0
The integer "concentration", I have checked if View1 even set the value
and it does, but when View2 tries to use it its always 0.
Why is it 0? Im allocating the View1 and init and everything :S

No comments:

Post a Comment