How does one use an already existing object from another class?
e.g. Have a object of Class1 and want to set its variables from Class2.
What does one import? Is it just necessary to import the Class1, will this make the object available to the class that imported?
In a class e.g. Main Class1 is created and presented
- (IBAction) openClass1 {
Class1 *c = [[Class1 alloc]initWithNibName:@"Class1" bundle:nil];
[self presentModalViewController:c animated:NO];
[c release];
}
Then Class1 would have many properties (I only made one here)
@interface Class1 : UIViewController {
UIImageView *image;
}
@property(nonatomic, retain) UIImageView *image;
@end
I would like to edit the Class1 variables in Class2 and then dismiss the Class2 view and see the changes in Class1. e.g. a label with new text or a UIImage with another image set to it etc.