UITextField的placeholder文字的位置,颜色等的自定义设置

//控制placeHolder的位置,左右缩20

-(CGRect)placeholderRectForBounds:(CGRect)bounds

{

   CGRect inset = CGRectMake(bounds.origin.x+100, bounds.origin.y, bounds.size.width -10, bounds.size.height);//更好理解些

   return inset;

}

//控制显示文本的位置

-(CGRect)textRectForBounds:(CGRect)bounds

{

    CGRect inset = CGRectMake(bounds.origin.x+190, 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, bounds.size.height);

   return inset;

}

 

//控制placeHolder的颜色、字体

- (void)drawPlaceholderInRect:(CGRect)rect

{

     [[UIColor orangeColor] setFill];

    [[selfplaceholder] drawInRect:rectwithFont:[UIFontsystemFontOfSize:20]];

}

posted @ 2016-04-25 23:17  风雨彩  阅读(1750)  评论(0编辑  收藏  举报