I need to implement the concept of dropdown
in Xcode.
For that purpose, I'm using a UIPickerview
.
This pickerView loads when a textfield is tapped (on textFieldDidBeginEditing:)event.
Question:
Is there a way, that I can add a image to TextField
?
The image is like an arrow mark by which user can understand that a dropdown
appears when textfield
is tapped .How can I make it?
Drag and drop image onto Xcode's assets catalog. Or, click on a plus button at the very bottom of the Assets navigator view and then select “New Image Set”. After that, drag and drop an image into the newly create Image Set, placing it at appropriate 1x, 2x or 3x slot.
UITextField has a rightView
property, if you have image like this- 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"]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With