zoukankan      html  css  js  c++  java
  • 自定义UITextField的文本内容位置

    textRectForBounds:
    Returns the drawing rectangle for the text field’s text.

    - (CGRect)textRectForBounds:(CGRect)bounds

    Parameters
    bounds
    The bounding rectangle of the receiver.

    Return Value
    The computed drawing rectangle for the label’s text.

    Discussion
    You should not call this method directly. If you want to customize the drawing rectangle for the text, you can override this method and return a different rectangle.

    The default implementation of this method returns a rectangle that is derived from the control’s original bounds, but which does not include the area occupied by the receiver’s border or overlay views.

     

    1
    2
    3
    4
    5
    6
    7
    - (CGRect)textRectForBounds:(CGRect)bounds {
        return CGRectMake(bounds.origin.x + 16.0f, bounds.origin.y, bounds.size.width, bounds.size.height);
    }
     
    - (CGRect)editingRectForBounds:(CGRect)bounds {
        return CGRectMake(bounds.origin.x + 16.0f, bounds.origin.y, bounds.size.width, bounds.size.height);
    }
     

     

    http://www.cocoachina.com/bbs/read.php?tid-7444.html

  • 相关阅读:
    Git/GitHub使用技巧
    《暗时间》第一遍读书心得整理
    学习方法摘要总结
    Py爬虫项目
    2018年6月12日
    狐狸坑蛋糕
    Codeforces 371C Hanburgers
    【别忘咯】 关于运算优先级
    【noip 2009】 乌龟棋 记忆化搜索&动规
    【Openjudge】 算24
  • 原文地址:https://www.cnblogs.com/easonoutlook/p/2642821.html
Copyright © 2011-2022 走看看