KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have this code to add a 26 x 30 .png file into the right view of a UITextField. //add button to address bar //UIButton *refreshButton = [UIButton buttonWithType:UIButtonTypeInfoDark]; UIButton *refreshButton = [UIButton buttonWithType:UIButtonTypeCustom]; [refreshButton setImage:[UIImage imageNamed:@"refresh.png"] forState:UIControlStateNormal]; [refreshButton setImage:[UIImage imageNamed:@"refresh.png"] forState:UIControlStateHighlighted]; refreshButton.imageEdgeInsets = UIEdgeInsetsMake(0, -16, 0, 0); [refreshButton addTarget:self action:@selector(refresh) forControlEvents:UIControlEventTouchUpInside]; addressBar.rightView = refreshButton; addressBar.rightViewMode = UITextFieldViewModeUnlessEditing; the button is touchable and calls the method that it should, but the image is not displayed. any ideas? could it be that the image is too big for the text field? My text field is the standard size that I dragged into from IB, so I don't think that's it, but it's an idea. the text field is 245 x 31
Tags (comma-separated)
Save Edits
Cancel