开发者

editingRectForBounds: moves my background image of UITextField to left

My question is this,

I have a UITextField that has a background image applied to it through IB, I am attempting to move the margin of the left side in 10px. However when i do the following, the background image moves with the text. Any thoughts?

textField.bounds = [self editingRectForBounds:textField.bounds];
textField.bounds = [self textRectForBounds:textField.bounds];


- (CGRect)textRectForBounds:(CGRect)bounds {
    CGRect inset = CGRectMake(bounds.origin.x + 10, bounds.origin.y, bounds.size.width - 10, bounds.size.height);
    return inset;
}

- (CGRect)editingRectForBounds:(CGRect)bounds {
    CGRect inset = CGRectMake(bounds.origin.x + 10, bounds.origin.y, bounds.size.width - 10, b开发者_如何学运维ounds.size.height);
    return inset;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜