UITextField placeholder string is always Top aligned in ios7

后端 未结 6 2623
滥情空心
滥情空心 2021-02-20 00:44

I have subclass the UITextField class and did the below code

- (void)drawPlaceholderInRect:(CGRect)rect
{

    [self.placeHolderTextColor setFill];
    [self.pl         


        
6条回答
  •  梦谈多话
    2021-02-20 01:25

    Why not just shift the drawing rect and then invoke the super method implementation call? Swift code ensues...

    override func drawPlaceholderInRect(rect: CGRect) {
        var newRect = CGRectInset(rect, 0, 2)
        newRect.origin.y += 2
        super.drawPlaceholderInRect(newRect)
    }
    

提交回复
热议问题