如何將UITextField
字符串複製到UITextView
? 我想在UIButton
;將UITextField字符串複製到UITextView
[myUIButton addTarget:self action:@selector(touchButton) forControlEvents:UIControlEventTouchUpInside];
UITextField* textField (initialized, omit code here)
[self.view addSubview:textField];
//save string to the property
self.textFieldString = textField.text;
//textFieldString is @property NSString* textFieldString; at the header.
UITextView* textView (initialized, omit code here)
[self.textView setEditable:false];
[self.view addSubview:self.textView];
//here i want to implement UITextField string -> UITextView display
-(void)submitButtonClicked {
//....
//Problem i am having here is that, I can not see instance variable other than @property variable. How should I pass UITextField .text to UITextView?
}
so make textView a ivar and you'll see it –
您還可以標記文本字段和文本視圖並檢索它們。例如:'[self.view viewWithTag:kTxtFieldTag]'; – Amar