An IBOutlet
is just behaving like any other property or instance variable. So if you want to pass that reference to another class, just do exactly that. Note that you do not need to specify an instance variable with the same name as the property. The current runtime will handle this itself.
If you want to pass a reference to the UITextField, add a property to your text view.
@interface TextView : UIView
@property (retain, nonatomic) UITextField *saveTextField;
...
@end
In your SaveTextViewController you can now set that property. You can do this in the viewWillAppear:
method for example.
@implementation SaveTextViewController
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.textView.saveTextField = self.saveText
}
@end
Also note that if you need a reference to the TextView and you created that in your nib/storyboard, add another IBOutlet to the SaveTextViewController.
#import "TextView.h"
@interface SaveTextViewController : UIViewController
@property (retain, nonatomic) IBOutlet UITextField *saveText;
@property (retain, nonatomic) IBOutlet TextView *textView;
@end
Finally I would also recommend you to rename saveText to saveTextField, because that's what it is. Also, you seem to be using unsanitized user input data from text fields and feed them into filenames. This is generally a bad idea™. I would recommend you to think about what you are actually trying to do. This is potentially dangerous and can lead to data loss and more fun stuff.