我正在尝试将带有圆角的 UITextField 加载到 iOS 的表格视图中。在大多数情况下,一切正常。但是,由于角半径属性,最左边的字符会被部分截断。有没有办法在输入到 UITextField 的文本上设置边距,以便正确显示?这是我的代码:
textInput = [[UITextField alloc] init];
textInput.backgroundColor = [UIColor whiteColor];
textInput.placeholder = @"example@gmail.com";
textInput.textColor = [UIColor blackColor];
textInput.keyboardType = UIKeyboardTypeEmailAddress;
textInput.returnKeyType = UIReturnKeyDone;
[[textInput layer] setBorderColor:[[UIColor whiteColor] CGColor]];
[[textInput layer] setBorderWidth:2.3];
[[textInput layer] setCornerRadius:15];
[textInput setClipsToBounds: YES];
[textInput setDelegate:self];
[self.contentView addSubview:textInput];
[textInput release];