iOS13 UITextField 设置leftView大小不生

2020-01-06  本文已影响0人  Lee坚武
_account = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, inputW, inputH)];
    _account.center = CGPointMake(SDKWindowW/2, self.logoView.frame.origin.y + self.logoView.frame.size.height);
    [_account setBackground:[UIImage imageNamed:XHIMG_INPUTBG]];
    UIView *accountView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, inputH, inputH)];
    UIImageView *accountLView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:XHIMG_ICON_PHONE]];
    accountLView.frame = CGRectMake(0, 0, inputH, inputH);
    [accountView addSubview:accountLView];
    _account.leftView = accountView;
    _account.leftViewMode = UITextFieldViewModeAlways;
    _account.placeholder = @"请输入手机号";
    _account.autocapitalizationType = UITextAutocapitalizationTypeNone;
    _account.font = fontNormal;
    _account.delegate = self;
    [self.view addSubview:_account];
上一篇 下一篇

猜你喜欢

热点阅读