[英]ios/objective-c: Create Segue from Textview to View Controller in Storyboard
I would like a user to be able to tap on a textview (that does not accept input) and segue to another View Controller for editing the textview. 我希望用户能够点击一个textview(不接受输入)并选择另一个View Controller来编辑textview。
Is this possible using storyboard? 使用情节提要可以吗?
If you simply drag from the textview to the other view controller, you are not given an option to create a segue. 如果您只是简单地从textview拖动到另一个视图控制器,则无法选择创建segue。
Thanks for any suggestions on how to do this. 感谢您对执行此操作的任何建议。
Connect your UITextView delegate to the view controller 将您的UITextView委托连接到视图控制器
Control-click and drag from the view controller icon to destination view controller to create a segue 按住Control键单击并从视图控制器图标拖动到目标视图控制器以创建序列
Choose "show" 选择“显示”
Click on the segue arrow and give it an identifier 单击segue箭头并为其指定一个标识符
Add the UITextViewDelegate to your view controller 将UITextViewDelegate添加到您的视图控制器
@interface ViewController <UITextViewDelegate>
Implement the delegate method 实现委托方法
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
[self performSegueWithIdentifier:@"PUSH_NEXTVIEWCONTROLLER" sender:textView];
return NO;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.