简体   繁体   English

ios / objective-c:从Textview创建Segue到Storyboard中的View Controller

[英]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.

相关问题 IOS / Objective-C / Storyboard:从左到右的自定义Segue在视图控制器之间创建黑条 - IOS/Objective-C/Storyboard: Custom Segue from Left to Right Creating Black Bar Between View Controllers 从Xib到故事板Objective-C的Segue - Segue from xib to storyboard objective-C IOS / Objective-C / Storyboard:检测正在进行的表演 - IOS/Objective-C/Storyboard: Detect when show segue underway ios/objective-c/storyboard:如何将 Storyboard 中视图控制器中的标签连接到核心类中的插座 - ios/objective-c/storyboard: How to connect label in view controller in Storyboard to outlet in core class ios / xcode / objective-c:导航到嵌入在导航控制器中的模态视图控制器 - ios/xcode/objective-c: Segue to modal view controller embedded in navigation controller IOS/Objective-C/Storyboard:推送视图控制器的后退按钮未激活 - IOS/Objective-C/Storyboard: Back Button of Pushed View Controller Not Active IOS / Objective-C:在没有情节提要Segue的情况下,可以在模式转换中使用自定义Segue吗? - IOS/Objective-C: Possible to Use Custom Segue in Modal Transition in Absence of a Storyboard Segue? 如何从iOS Objective-C中的控制器重绘自定义视图 - how to redraw custom view from the controller in ios objective-c 如何在objective-c中导航到新故事板文件上的视图控制器 - How to navigate to a view controller on a new storyboard file in objective-c 从Objective-C中的UIApplicationShortcutItem正确实现打开故事板视图控制器的实现 - Correct implementation of opening storyboard view controller from UIApplicationShortcutItem in objective-c
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM