我有一个新的愚蠢问题,我用三个文本字段创建了子视图,我连接得很好,现在当我点击任何文本字段时,它的工作直到第三次尝试之后它不起作用,现在我很困惑到底发生了什么,我通过添加textfild西布。
- (IBAction)weightMethod:(id)sender
{
centimeterTextField.placeholder = @" Centimeters";
self.centimeterTextField.delegate=self;
self.centimeterTextField.tag=3;
self.centimeterTextField.borderStyle = UITextBorderStyleRoundedRect;
self.centimeterTextField.clearsOnBeginEditing=YES;
[ self.centimeterTextField setBackgroundColor:[UIColor whiteColor]];
ptextfield.placeholder = @" Feet";
self.ptextfield.delegate=self;
self.ptextfield.tag=4;
self.ptextfield.borderStyle = UITextBorderStyleRoundedRect;
self.ptextfield.clearsOnBeginEditing=YES;
[self.ptextfield setBackgroundColor:[UIColor whiteColor]];
ptextfieldInches.placeholder = @" Inches";
self.ptextfieldInches.delegate=self;
self.ptextfieldInches.tag=5;
self.ptextfieldInches.borderStyle = UITextBorderStyleRoundedRect;
[ptextfieldInches setBackgroundColor:[UIColor whiteColor]];
self.ptextfieldInches.clearsOnBeginEditing=YES;
[self.centimeterTextField setKeyboardType:UIKeyboardTypeNumberPad];
[self.ptextfieldInches setKeyboardType:UIKeyboardTypeNumberPad];
[self.ptextfield setKeyboardType:UIKeyboardTypeNumberPad];
}
令人惊奇的事实是,当我没有将插座连接到任何文本字段时,它会一直工作,直到您做出响应。