I want to achieve the following picture's button state. When the "starts.." area is touched, the area is highlighted and a datepicker pops up. My approach is creating a full-width button and place two labels Starts, Today 12:00AM on top of it. When the user touches the button I respond to the action by pulling up a datepicker. Here are my questions.
- Is this approach conventional?
How do I make a button go into a "selected" state? I tried the following to change the background image:
UIImage *buttonImage = [[UIImage imageNamed:@"btn_carrot.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(18, 18, 18, 18)]; UIImage *buttonImageHighlight = [[UIImage imageNamed:@"btn_light_carrot.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(18, 18, 18, 18)]; [self.startDateButton setBackgroundImage:buttonImage forState:UIControlStateNormal]; [self.startDateButton setBackgroundImage:buttonImageHighlight forState:(UIControlStateHighlighted | UIControlStateSelected)];
However, the button never goes into a selected state. It changes its color briefly. Thank you!