user3626407
user3626407

Reputation: 287

How to pass values from a subclass of UIView to UIViewController class

I have a class Graph that subclasses UIView.

I am in my view controller class and I call the SliderView class with the following code

- (void)viewDidLoad
{
    [super viewDidLoad];

    if (self) {
        // Custom initialization
        SliderView = [[SliderView alloc] init];
    }

    [self setView: SliderView];
}

I'd like to be able to access to the properties I have setup in SliderView in my view controller class. How can I do this?

Upvotes: 0

Views: 411

Answers (2)

carloabelli
carloabelli

Reputation: 4349

Use the getters and setters like Kyle said (he just went further showing the property).

[graph propertyName] and [graph setPropertyName:newValue]

I would also take a look at: http://cocoadevcentral.com/d/learn_objectivec/

Upvotes: 1

Kyle
Kyle

Reputation: 1672

You should just be able to access the properties of the Graph class. In your Graph class you might have some thing along the lines of:

@property (nonatomic, strong) NSObject *propertyName;

You would access it in the UIViewController by way of something like

[(Graph *)self.view propertyName];

Upvotes: 0

Related Questions