I need to access this IBOutlet's value in another class.. How would I go about doing this?
Heres my SaveTextViewController.h class
#import <UIKit/UIKit.h>
@interface SaveTextViewController : UIViewController{
IBOutlet UITextField *saveText;
}
@property (retain, nonatomic) IBOutlet UITextField *saveText;
@end
And here is my TextView.m class
#import "TextView.h"
#import "SaveTextViewController.h"
@implementation TextView
- (IBAction)saveTextView{
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [documentPaths objectAtIndex:0];
//Trying to access the returned variable "saveText" from IBOutlet in SaveTextViewController
NSString *documentTXTPath = [documentsDirectory stringByAppendingPathComponent:@"%d",saveText];
NSString *savedString = self.text;
[savedString writeToFile:documentTXTPath atomically:YES];
NSLog(@"%@", documentTXTPath);
}
Thanks!