Reputation: 914
The method - (void)setImage:(UIImage *)image forState:(UIControlState)state of UIButton.
Since if you have not set an image for the Selected state, then the Normal image will also appear when the button isSelected.
I mean I want to set image for normal state and only title(no image) for selected?
Sorry my English!
Upvotes: 0
Views: 66
Reputation: 318884
You call setImage:forState:
as many times as you need:
[someButton setImage:someNormalImage forState:UIControlStateNormal];
[someButton setImage:someSelectedImage forState:UIControlStateSelected];
Update: It appears you want a button that shows just an image for the normal state and just a title for the selected state. I don't know if the following will work but give it a try:
[someButton setImage:someNormalImage forState:UIControlStateNormal];
[someButton setImage:nil forState:UIControlStateSelected];
[someButton setTitle:@"Some Title" forState:UIControlStateSelected];
Upvotes: 0