【发布时间】:2011-04-18 07:10:47
【问题描述】:
我想将 UITextField.text 的左边距对齐到 10Px。请建议我最好的方法??在 roundedRect TesxtField 中相同,其中文本从左侧开始 10 px
几乎已经通过覆盖达到了 - (CGRect)textRectForBounds:(CGRect)bounds. 现在的问题是当 TextField 进入编辑模式时,它们的左边距重置为零......
@implementation UITextField(UITextFieldCatagory)
- (CGRect)textRectForBounds:(CGRect)bounds {
CGRect theRect=CGRectMake(bounds.origin.x+10, bounds.origin.y, bounds.size.width-10, bounds.size.height);
return theRect;
}
【问题讨论】: