【发布时间】:2012-05-23 05:18:50
【问题描述】:
我创建了一个 UIView* myView 然后我创建了一个 UITextVIew *tempUITextView 并将其文本设置为
[tempUITextView setText:@"some text"];
[myView addSubView: tempUITextView];
当我运行代码时,它给出了一个错误:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setText:]:
【问题讨论】:
-
请给出更详细的描述,textview的声明。以便识别。
-
从错误来看 tempUITextView 实际上并不是你想象的那样。 @iPhoneFun 是对的,向我们展示你是如何创建它的。
-
UIView* myView =[[[UIView alloc]initWithFrame:CGRectMake(0,0,100,90)]autorelease]; UITextView* tempUITextView =[[[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 30)]autorelease];
-
您是否在“ UITextView* title=[[[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 30)]autorelease]; 中发现错误?
-
在您的声明之上 - 检查它,这是完全错误的。您正在分配(我认为您已经写过)是错误的,您仍然不接受您的错误吗? "UITextView* tempUITextView =[[[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 30)]autorelease];"是什么意思
标签: iphone objective-c uiview uitextfield settext