What I am doing
I am making a project with Actionsheet with three buttons in it.
My problem
I want that when I press button 1 .It should be highlighted in orange when I press the button..
It should only change when I press the button
suggestion please..
As Evan Mulawski says in his answer here:
Without using undocumented API's,
there is no official way to change the
button's color on a UIActionSheet.
You may be able to customize this if
you subclass the UIActionSheet
control.
See this example:
http://blog.corywiles.com/customizing-uiactionsheet-buttons
Related
I have a toolbar with 5 buttons.
4 of them are regular bar button items and one of them is a custom one (A 'UIButton' inside a 'UIBarButtonItem').
I noticed that when I click between the regular buttons (not exactly on them), one of them (the closest one) still recieves the click event and is being highlighted (which is what I want).
But the custom bar button item does not show this behaviour.
When I tap between it and one of the regular buttons neither of the 2 receives the touch event. This probably because the UIButton is the one the gets the click event. Is there a way to add a touch event the containing bar button item as well? Or perhaps another way to solve this?
Thanks!
button.userInteractionEnabled = YES; I believe is the answer.
One solution might be that you create image of same as bar button item and assign to UIButton as background image, this will solve your issue.
Hope this helps you....
Solved it!
I added another UIView to the UIBarButtonItem and then I added the UIButton to the UIView.
I added a touch gesture to the UIView (And also kept the original touch event of the UIButton) that expanded the area that you can touch the button which solved the problem.
I have a button connected to an action.
When I set the background image on that button, the result is not visually appealing. I want just to see the image not the button but I want the ibaction functionality of that button.
Please help
You need a button with type UIButtonTypeCustom (this will stop the default button appearance from drawing). You can do this in interface builder or in code (although you can't change it once the button is initialized).
I've seen a dropdown-like button on many apps, including Turf Wars, that simulates a dropdown with a picker.
I need to use the same functionality in my app, but I'm not too sure what the best way to go about it may be.
Example:
I figured I could make two images and set them as a UIButtons background image for the different states and have the button open a pickerview.
Any input would be appreciated.
Rod
You can use a button with the image like dropdown image. And you can place a picker over that button hidden. In the click event you will show the picker. And after selection on picker you have to update the text value of the button and hide the picker again. Hope it helps you...
You can use a pop over that has picker in it.You can use use different images as UIButton background as you mentioned.It will give a feel of dropdown button.You can show popover on button action
At the time of click a button it's highlighted. While click the button i want to avoid the highlighting of button.
In my Application background image for the button is square shape if i'm click the button it shows square outline of the button.but my button is customtype only....
Please help me out to solve this....
Thank you
Renya
Try setting button's adjustsImageWhenHighlighted property to NO
set adjustsImageWhenHighlighted property to YES...
it will avoid the highlight of UIButton
If you are creating button using Interface Builder..
Inside the button Attribute Inspector ..
On the top .. there is drop down box.. which has different states of the button
like Default, Highlighted, Selected etc.. you can set Button's behavior here..
Did you try adding :
[ homebut setHighlighted:NO ];
?
how can i just change the color,of a button when i set the focus on the button in iphone.
I mean to say , for example we have 5 buttons, and i am just setting the focus on each of the button. i want those buttons to be higlighted with different color.
but when press or touch up inside the utton, the navigation is made to the respective forms, that is set for that button.
you can write method, for example, let it be
- (void) changeButtonState:(UIButton*) buttonToChange;
then you can call it in your onBtnClk method for button you need. in that method you can change image for your button's UIControlStateNormal mode. and if I understand right, you can use toolbar or tabbar instead of buttons.
Guess you have already asked this issue differently here..
But have you checked the answer?? You can use any of those methods at your will!