我尝试自定义我的UITextField对象
但是leftView正在向右移动一些像素
我怎样才能改变我的UITextField.leftView的位置
这是我的代码
NSArray *itemArray = @[@"<", @">"];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray];
segmentedControl.frame = CGRectMake(0, 0, 60, 26);
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
_urlTextField.leftView = segmentedControl;
_urlTextField.leftViewMode = UITextFieldViewModeAlways;
最佳答案 试试这个 …
NSArray *itemArray = @[@"<", @">"];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray];
**segmentedControl.center = CGPointMake(03, 15);**
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
self.textField.leftView = segmentedControl;
self.textField.leftViewMode = UITextFieldViewModeAlways;
同时将文本字段的边框样式更改为圆形矩形以外的其他样式.
希望这可以帮助
问候,
Paggy123