ios - Xcode 4 Storyboard,不想连接到 IBOutlet 的文本字段

标签 ios xcode

所以在 Storyboard中我有一个名为 FormViewController 的 UIViewController 类。我在 Storyboard 中设置了 ViewController 以使用它:

custom class

然后我在头文件中有三个文本字段:

#import <UIKit/UIKit.h>

@interface FormViewController : UIViewController

@property (strong, retain) IBOutlet UITextView *firstName;
@property (strong, retain) IBOutlet UITextView *lastName;
@property (strong, retain) IBOutlet UITextView *email;

- (IBAction) save:(id)sender;

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender;

@end

但是,当我尝试将 Storyboard中的那些连接到 View Controller 时,它不会弹出。

enter image description here

有什么想法吗?

最佳答案

UITextFieldUITextView 是两个截然不同的类——您创建了 UITextField 实例,但您的 outlet 类型为 UITextView.

只需将您的导出类型更改为 UITextField,一切都会好起来的!

(UITextView,郑重声明,是一个滚动的、通常可编辑的字段,更像是一个文字处理器。)

关于ios - Xcode 4 Storyboard,不想连接到 IBOutlet 的文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24535677/

相关文章:

iphone - 如何为特定的 UIBarButtonItem 着色?

ios - 如何让应用程序在 iPod 2nd gen 上运行

ios - 奇怪的 AQDefaultDevice 记录

ios - 如何在覆盖 UIView 之前停止幻灯片过渡到第二个 VC?

objective-c - 错误消息无法启动 + IOS/cordova

ios - 如何在 iOS 中隐藏状态栏?

ios - 麻烦交叉编译 Python 2 Xcode : kivy-ios distribution throwing error

ios - 设置 contentInset 时 UINavigationBar 自动折叠

Android react-native 应用程序不拾取字体

iOS Swift 将应用移至后台