我已经用 0 个结果搜索了“CFString isNaturallyRTL”。
这些是我的课:
//in .H
@interface myViewController : UIViewController {
UITextField *from;
UITextField *to;
NSString *fromText;
NSString *toText;
}
@property (nonatomic, retain) NSString* fromText;
@property (nonatomic, retain) NSString* toText;
@property (nonatomic, retain) UITextField *from;
@property (nonatomic, retain) UITextField *to;
//in .m
@synthesize from, to;
@synthesize fromText, toText;
viewDidLoad(...) {
fromText = @"Roma";
toText = @"Lecce";
}
- (void) drawRoute {
if ( ([[from text] length] > 2) && ([[to text] length] > 2) )
{
fromText = from.text;
toText = to.text;
[...]
}
}
现在,我有一个在按钮触摸时打开的视图,其中包含两个文本框和一个按钮。像这样。
- (void) drawRouteTextboxes {
from = [[UITextField alloc] initWithFrame: [...] ];
from.text = fromText;
from.delegate = self;
[ctr.view addSubview:from];
[from release];
to = [[UITextField alloc] initWithFrame: [...] ];
[...]
[searchButton addTarget:self action:@selector(drawRoute) forControlEvents: UIControlEventTouchUpInside];
}
一切正常,编译运行。
我第一次单击 drawRouteTextboxes 时,它会打开我的视图并设置默认文本(“Roma”和“lecce”)。第二次,我打开视图,编辑文本字段并调用 drawRoute。没关系。我第三次调用 drawRouteTextboxes 它返回我这个运行时错误:
*** -[CFString _isNaturallyRTL]: message sent to deallocated instance 0x3a8d140
我不知道问题出在哪里......有人知道解决方案吗?这是我第一次看到这个错误!
谢谢,阿尔贝托。