#import "XZCTextField.h"

@implementation XZCTextField

////控制清除按钮的位置
//-(CGRect)clearButtonRectForBounds:(CGRect)bounds
//{
//    return CGRectMake(bounds.origin.x + bounds.size.width - 50, bounds.origin.y + bounds.size.height -20, 16, 16);
//}

//控制placeHolder的位置,左右缩20
-(CGRect)placeholderRectForBounds:(CGRect)bounds
{
   
    //return CGRectInset(bounds, 20, 0);
    CGRect inset = CGRectMake(bounds.origin.x+10, bounds.origin.y, bounds.size.width -10, bounds.size.height);//更好理解些
    return inset;
}
//控制显示文本的位置
-(CGRect)textRectForBounds:(CGRect)bounds
{
    //return CGRectInset(bounds, 50, 0);
    CGRect inset = CGRectMake(bounds.origin.x+10, bounds.origin.y, bounds.size.width -30, bounds.size.height);//更好理解些
   
    return inset;
   
}
//控制编辑文本的位置
-(CGRect)editingRectForBounds:(CGRect)bounds
{
    //return CGRectInset( bounds, 10 , 0 );
   
    CGRect inset = CGRectMake(bounds.origin.x +10, bounds.origin.y, bounds.size.width -30, bounds.size.height);
    return inset;
}
////控制左视图位置
//- (CGRect)leftViewRectForBounds:(CGRect)bounds
//{
//    CGRect inset = CGRectMake(bounds.origin.x +10, bounds.origin.y, bounds.size.width-250, bounds.size.height);
//    return inset;
//    //return CGRectInset(bounds,50,0);
//}

////控制placeHolder的颜色、字体
//- (void)drawPlaceholderInRect:(CGRect)rect
//{
//    //CGContextRef context = UIGraphicsGetCurrentContext();
//    //CGContextSetFillColorWithColor(context, [UIColor yellowColor].CGColor);
//    [[UIColor orangeColor] setFill];
//   
//    [[self placeholder] drawInRect:rectwithFont:[UIFont systemFontOfSize:20]];
//}

@end

TextField 的文字间距的更多相关文章

  1. TextField的文字距左边框的距离偏移

    默认情况下,当向textField输入文字时,文字会紧贴在textField左边框上. 我们可以通过设置textField的leftView,设置一个只有宽度的leftView. 这样还不够,因为默认 ...

  2. 怎样使用CSS设置文字与文字间距距离?

    [文字与文字间距距离,字与字距离间距CSS如何设置?]如果你也遇到W3Cschool用户唐婷大小姐类似的问题不妨也到W3Cschool编程问答进行提问. 对于使用CSS解决字间距的方法W3Cschoo ...

  3. 段落排版--中文字间距、字母间距(letter-spacing, word-spacing)

    中文字间隔.字母间隔设置: 如果想在网页排版中设置文字间隔或者字母间隔就可以使用    letter-spacing 来实现,如下面代码: h1{ letter-spacing:50px; } ... ...

  4. 限制textfield的文字长度

    -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementSt ...

  5. css 文字间距

    letter-spacing :  字与字之间的距离 text-indent : 行的抬头间距 line-height : 行高度

  6. iPhone UIButton图标与文字间距设置【转】

    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(50, 50, 150, 50)]; [button setTitle:@& ...

  7. WPF文字间距

    代码: <ItemsControl ItemsSource="{Binding Info}" FontFamily="微软雅黑" FontSize=&qu ...

  8. 设置textfield 文字左边距

    默认情况下,当向textField输入文字时,文字会紧贴在textField左边框上.我们可以通过设置textField的leftView,设置一个只有宽度的leftView.这样还不够,因为默认le ...

  9. WPF 竖排文字

    ---恢复内容开始--- 想做一个WPF 文字竖排 类似上图.用在TabItem的header上面. <TextBlock FontSize="30" Text=" ...

随机推荐

  1. 大师教你<部落冲突>如何切换账号

    前提申请两个谷歌账号,账号一和账号二,想要切换账号,只需清除部落冲突在手机上的数据即可.详情请看下文! 1. 第一次登陆,进入游戏后 2. 没有谷歌商店的童鞋,下载谷歌安装器(一键修复)以及VPNFQ ...

  2. shell 脚本定时创建月份表

    #!/bin/shuser='root'pass='root'name='vfc_sport' # 数据表名定义timestamp=`date -d "next month" +% ...

  3. (C#)算法题

    1. Convert string from "AAABBCC" to "A3B2C2". 当面试者提出这个问题的时候,首先需要确认题意:譬如:字符串是不是顺序 ...

  4. (Design Pattern) Singleton.

    Role: The purpose of the Singleton pattern is to ensure that there is only one instance of a class, ...

  5. Nuget 管理entity framework

    安装,带版本号 PM> Install-Package EntityFramework -Version 5.0.0 更新数据库 PM> Enable-Migrations -Contex ...

  6. 预处理语句--#define、#error和#warning

    1.#define语句 我们经常会这样定义一些宏:       #define BLOCK 8192 但这样的宏却不能在字符串中展开,如:    printf("The BLOCK numb ...

  7. l类型转换错误ClassCastException

    出现问题原因story中参数写错:

  8. 54. Search a 2D Matrix && Climbing Stairs (Easy)

    Search a 2D Matrix Write an efficient algorithm that searches for a value in an m x n matrix. This m ...

  9. Django model中常见Field types , Field options

    AutoField :自增,数据库 BooleanField:布尔型 CharField:字符型 DateField:日期,datetime.date类的实例.有两个常用的option,auto_no ...

  10. Linux下多线程,断点续传,命令行下载工具axel

    From: http://www.2cto.com/os/201202/118482.html 安装办法: $ sudo pacman -S axel 使用方法: $ axel -n 10 -o /文 ...