textfield

作者: 赤焰军少帅林殊 | 来源:发表于2018-01-17 10:40 被阅读5次

    import "ZYTextField.h"

    @implementation ZYTextField

    • (instancetype)initWithFrame:(CGRect)frame
      {
      self = [super initWithFrame:frame];
      if (self) {

      }
      return self;
      }

    //控制placeHolder的位置
    -(CGRect)placeholderRectForBounds:(CGRect)bounds
    {
    CGRect inset = CGRectMake(bounds.origin.x+15kRating, bounds.origin.y, bounds.size.width -15kRating, 30*kRating);
    return inset;
    }

    //控制显示文本的位置
    -(CGRect)textRectForBounds:(CGRect)bounds
    {
    CGRect inset = CGRectMake(bounds.origin.x+15, bounds.origin.y, bounds.size.width -15, bounds.size.height);
    return inset;
    }

    //控制编辑文本的位置
    -(CGRect)editingRectForBounds:(CGRect)bounds
    {
    CGRect inset = CGRectMake(bounds.origin.x +15, bounds.origin.y, bounds.size.width -15, bounds.size.height);
    return inset;
    }

    相关文章

      网友评论

          本文标题:textfield

          本文链接:https://www.haomeiwen.com/subject/nxvyoxtx.html