【发布时间】:2011-09-19 14:58:35
【问题描述】:
我试图将 UITextView 的字符串从 anotherViewController 等于 MainViewController 。我的意思是用户从 anotherViewController 在 UITextView 中写一些东西,当触摸完成按钮时, UITextView 中的字符串应该等于 MainViewController 中的另一个字符串。如何访问 UITextView ???
我做了这样的事情,但没有得到任何结果!
#import "AnotherViewController"
@class AnotherViewController;
@interface MainViewContoller : UIViewController {
NSString *main_string;
AnotherViewController *textEntered;
}
-(void)viewDidLoad {
textEntered.TEXT = main_string
}
***TEXT 是我在 AnotherViewController 上的 UITextView 的名称。
已编辑:
@interface AnotherViewController : UIViewController {
UITextView *TEXT;
id delegate;
}
@property (nonatomic, retain) IBOutlet UITextView *TEXT;
@property (nonatomic ,retain) id delegate;
@end
@implementation AnotherViewController
@synthesize TEXT ,delegate;
- (IBAction)doneButton {
//!!! problem with compare ! the compiler got me some warning
[self dismissModalViewControllerAnimated:YES];
}
主视图控制器
#import "AnotherViewController.h"
@class Another...;
@interface MainViewControlelr : UIViewController {
NSString *main_string;
TextViewController *textEntered;
}
- (void)viewDidLoad
{
textEntered.delegate = self;
}
- (void) compareText {
[textEntered.TEXT isEqual:main_string];
}
【问题讨论】:
标签: ios xcode uitextview