首页 > 其他 > 详细

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

时间:2016-04-26 00:35:56      阅读:250      评论:0      收藏:0      [点我收藏+]

//控制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]];

}

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

原文:http://www.cnblogs.com/lcl15/p/5433232.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!