扫码关注官方订阅号
如图这样的,storyboard里面找textfield的属性面板没有找到解决方法~求指教。
光阴似箭催人老,日月如移越少年。
你可能要用代码解决:
UITextField *textField = [[UITextField alloc] init]; [textField setLeftViewMode:UITextFieldViewModeAlways]; [textField setLeftView:<#your-icon-image-view#>];
自带属性leftView和rightView
- (void)configureUserText:(rewriteFiled *)text { text.clearButtonMode = UITextFieldViewModeWhileEditing; text.adjustsFontSizeToFitWidth = YES; text.returnKeyType = UIReturnKeyDone; self.userView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 70, 30)]; UIImageView *userMageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 4.5, 22, 22)]; userMageView.image = [UIImage imageNamed:@"user"]; UILabel *userName = [[UILabel alloc] initWithFrame:CGRectMake(30, 4, 40, 22)]; userName.text = @"账号:"; userName.font = [UIFont systemFontOfSize:15]; [self.userView addSubview:userMageView]; [self.userView addSubview:userName]; text.leftView = self.userView; text.leftViewMode = UITextFieldViewModeAlways; text.delegate = self; }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
你可能要用代码解决:
自带属性leftView和rightView