tags:

views:

22

answers:

1

Hi

I have my View1 in which I have a variableView1 and when I click on a button, I have another view2 which opens. In there, I have a variableView2 which takes a value from a list of actions.

I need to access variableView2 from my View1, how can I do this, I'm confused :(

+1  A: 

Partial Implementation:

@interface view1 {
    UIVIew view2;

}

@end

@implementation

- (void) doSomething{
    int b = [view2 variableView2]; //<-- accessor method

}

@end

@interface view 2 {
    int variableView2;
}
@property int variableView2;
@end

@implementation
@synthesize variableView2;
@end

This is a very basic question. I strongly suggest you pick up "iphone programming for dummies" or some other basic help book.

Stephen Furlani
Thanks Stephen. I have one more question, I need to update a label which is on view1 when view2 closes, how do I do this??? :s
okayasu
use the delegate pattern. Set an `@property (assign) UIVIew *view1;` in `view2` and when `view2` closes, call `[view1.label setStringValue:@"blahblah"];` (code may not be exact, use the docs).
Stephen Furlani