0
我在屏幕上有两个文本框,但只有第二个文本框没有收到触摸事件。我检查了背景色并已将setDelegate设置为self.First textfield工作正常。我以编程方式创建了文本框。这里是我的代码:UITextField没有收到触摸事件
txtMsg = [[UITextField alloc] init];
txtMsg.delegate = self;
txtMsg.placeholder = @"Type your message here..";
txtMsg.frame = CGRectMake(10, 190, 300, 40);
txtMsg.textColor = [UIColor blackColor];
txtMsg.layer.borderColor = [UIColor lightGrayColor].CGColor;
txtMsg.layer.borderWidth = 1.0f;
txtMsg.backgroundColor = [UIColor blueColor];
txtMsg.autocapitalizationType = UITextAutocapitalizationTypeNone;
txtMsg.autocorrectionType = UITextAutocorrectionTypeNo;
txtMsg.font = [UIFont systemFontOfSize:16];
[txtMsg setBorderStyle:UITextBorderStyleLine];
[self.view addSubview:txtMsg];
任何想法是什么错?
您创建了两个文本框编程吧? – micky
它对我来说工作得很好! – micky
你可以用两个文本框编写代码吗? –