UITextField的placeholder文字的位置,颜色等的自定义设置
2016-04-25 23:17
513 查看
//控制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]];
}
-(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]];
}
相关文章推荐
- 队列(Queue)
- ${pageContext.request.contextPath}和<%=request.getContextPath()%>
- java.sql.SQLException:value;'0000-00-00'can not be represented as java.sql.date
- Android消息机制探索(Handler,Looper,Message,MessageQueue)
- hdu 5667 Sequence(矩阵快速幂+快速幂+费马小定理)(bestcoder# 80 1002)
- iOS--UILable自适应大小
- [Lintcode] Unique Paths I,II
- APUE------守护进程
- winform中textbox属性Multiline=true时全选
- 石家庄铁道大学网站首页UI分析
- HTML标签marquee实现滚动效果
- flask-admin章节二:wtforms的使用以及在数据库场景中使用QuerySelectField代替SelectField
- operator is not allowed for source level below 17 and Android requires compiler compliance level 5.0
- UEFI+GPT、Legacy+MBR引导模式介绍 & 引导修复教
- easyui datagrid 不显示分页栏,可以自定义显示分页按钮
- 对UIView 实例方法的探索
- 在一个UILabel中实现不同的字体和颜色
- 探秘Java中的String、StringBuilder以及StringBuffer
- 如何使UICollectionView的Header悬浮
- iOS UIImageView 动图