ViewController.h
@interface ViewController : UIViewController{
IBOutlet UITextField *Signup;
IBOutlet UITextField *Login;
}
@property(nonatomic, retain)IBOutlet UITextField *Signup;
@property(nonatomic, retain)IBOutlet UITextField *Login;
-(IBAction)TYPE:(id)sender;ViewController.m
@synthesize Signup;
@synthesize Login;
-(IBAction)TYPE:(id)sender{
[Signup resignFirstResponder];
[Login resignFirstResponder];
}在模拟器中,当我单击textfield时,会得到以下错误消息:
2017-04-14 18:43:52.616362 Prototype13075 13075:119579用于systemgroup.com.apple.configurationprofiles路径的系统组容器是systemgroup.com.apple.configurationprofiles 2017-04-14 18:43:52.640402 Prototype13075 13075:119579从私有有效用户设置读取。2017-04-14 18:43:52.727 Prototype13075 13075:119579找不到支持键盘iPhone-PortraitChoco-NumberPad类型4的键盘;使用1316927560_PortraitChoco_iPhone-Simple-Pad_Default 2017-04-14 18:43:53.607676 Prototype13075 13075:119579 _BSMachError:端口7403;(os/kern)无效能力(0x14)“无法插入COPY_SEND”2017-04-14 18:43:53.608246 Prototype13075 13075:119579 _BSMachError:端口7403;(os/kern)无效名称(0xf)“无法发送正确发送”
我已经两年没有使用Xcode了,但是同样的代码工作得很好,为什么Xcode 8,iOS 10不能工作呢?
发布于 2017-04-15 00:47:11
Xcode 8的模拟器非常冗长。这些信息并不意味着什么特别的。
- BTW --
您的代码是以一种非常旧的风格编写的,这已经不是最佳实践了。更好的办法是:
@interface ViewController : UIViewController
// It's no longer necessary to have your properties between { and }
@property (nonatomic, weak) IBOutlet UITextField *signup;
@property (nonatomic, weak) IBOutlet UITextField *login;
// IBOutlets should be weak, other properties should be weak or strong for objects, or assign for structs and values.
@end
@implementation ViewController
// You don't have to synthesize your properties anymore.
- (IBAction)type:(id)sender {
[self.signup resignFirstResponder];
[_login resignFirstResponder];
// but you do have to either use self. or underscore to refer to them.
}
@endhttps://stackoverflow.com/questions/43420966
复制相似问题