【问题标题】:How to add left side margin on leftview of uitextfield in ios?如何在ios中的uitextfield的leftview上添加左侧边距?
【发布时间】:2013-10-04 14:57:26
【问题描述】:

我必须设置分配给左视图的图像框架。 查看我的代码。

UIImageView *imageView = [[UIImageView alloc] init];

imageView.frame = CGRectMake(0,0 ,15, userNameTextField.frame.size.height);

userNameTextField.leftViewMode = UITextFieldViewModeAlways;
userNameTextField.leftView = imageView;

【问题讨论】:

    标签: ios textfield


    【解决方案1】:

    边距在 iOS UIKit 中作为内容插入实现。以下代码将导致文本视图左侧有 5 个像素的边距

    [atextView setTextContainerInset:UIEdgeInsetsMake(0, 5, 0, 0)];

    【讨论】:

      猜你喜欢
      • 2011-08-06
      • 2013-12-03
      • 2015-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-26
      相关资源
      最近更新 更多