Add image to UITextField in Xcode?

后端 未结 9 940
时光取名叫无心
时光取名叫无心 2020-12-23 08:41

\"enter

I need to implement the concept of dropdown in Xcode.

For

9条回答
  •  北海茫月
    2020-12-23 09:30

    You can put the UIImageView to the left of your UITextField.

    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(96, 40, 130, 20)];
    [textField setLeftViewMode:UITextFieldViewModeAlways];
    textField.leftView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"searchIccon.png"]];
    

提交回复
热议问题