PDA

View Full Version : Making programmatic UIButton highlight onclick




vegashacker
Jul 2, 2008, 06:17 PM
Check out, for example, the UICatalog sample app. Under "Buttons", click the first button (labeled "Gray") and no visual feedback is given to the user that it was clicked. You have to hold down in order to make it appear that it was clicked. In fact, the button *is* being clicked in the first case, it's just not visually showing that (I know this because you can look in the console logs which running the simulator).

Is this a bug? Expected behavior? In either case, how do I make it look like the button is being clicked when it is clicked. Note that if you make a button with IB, there is no problem. So it's something with programmatically generating buttons.

Thanks,
Rob



vegashacker
Jul 2, 2008, 07:17 PM
This may be about buttons inside of table views. When I place the button on top of the table view (instead of in a table cell), the clicking behavior is normal.

tacoman667
Jul 2, 2008, 08:36 PM
This may be about buttons inside of table views. When I place the button on top of the table view (instead of in a table cell), the clicking behavior is normal.

Have you looked into the documentation for the iPhone UITableView on overriding the selectRowFromIndexPath or whatever it's called? You may need to do that and inside the method set the "state" of the button to the highlighted state? (I haven't gone that far just yet myself.)

I am so far behind, too much side work and not enough time to work on my personal app. I still don't feel guilty for paying 99 bucks for the program though! :)