Add image to UITextField in Xcode?

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

\"enter

I need to implement the concept of dropdown in Xcode.

For

9条回答
  •  误落风尘
    2020-12-23 09:44

    UITextField has a rightView property, if you have image like this- enter image description here then You can easly set ImageView object to rightView:

    UITextField *myTextField = [[UITextField alloc] init];
    
    myTextField.rightViewMode = UITextFieldViewModeAlways;
    myTextField.rightView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"downArrow.png"]];

提交回复
热议问题