uibutton property to avoid highlights - iphone

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 ];
?

Related

How to add a custom clear button in UITextField?

I want to resize the default clear button of UITextField. After I googled a lot, I came to know there is no way to modify it.
So I decided to go with Custom option ie, by adding UIButton to text field.I found some code from S.O, but nothing works for me. These are the links which I referred.
Custom UITextField clear button
Custom clear button for UITextField
Custom clear button in UISearchBar text field
So please suggest some solution which behaves exactly as default clear button of UITextField
Any help will be appreciated.
Thanks in advance.
In addition to the jake9115 response, you can emulate the clearbutton behavior by using the UITextFieldDelegate callbacks.
You can try in this way:
Show the button when -textFieldDidBeginEditing: is called
Hide the button when -textFieldDidEndEditing: is called
Hide the button if in -(BOOL)textFieldShouldClear:(UITextField*)textField the length of the textField's text is 0.
Why not just make a button that sets the TextView's value to ""?
- (IBAction)button:(id)sender {
_myTextView.text = "";
}

iPhone UIButton provide different inset values for highlighted state

I want my titleLabel text move a little down on button tap (i.e. I want to give different inset values for highlighted and default states).
I have custom button background images and the button goes down in highlighted state image but the text on it stands at the same place so it gives a bad effect and looks like the text is seperated from button.
Is there any way to solve this?
Thanks in advance
The easiest way to do this is to put your text on the button's background image.
If you can't do that for some reason you can try to add IBAction on Button down and adjust button.titleLabel.frame.

UIButton states

I am making multiple custom buttons that look much like this:
It is a simple button with either the green or gray in the "indicator view". What I need some explanation for is: In interfacebuilder there are four states a button can have; Normal, Highlighted, Selected and Disabled. When I provide images for everything except disabled I thought that normal would be when no touches were made on the button, highlighted is while you hold your finger on it and selected would be when after you release finger.
However I do not think thats right now. I use the touch-up-inside event. Is it correct that I need to set the selected/highlighted etc property on the button?
Thank you for your time.
You might want to set to selected and not highlighted.
Highlight is darkening the button for a fraction when touching the UIButton. UIButton can modify your image automaticaly so usually you don't need to provide a highlight image.
Disabled is when it is disabled.
Selected is when it is selected. You can invert the select flag on touch up inside event to make a state button.
[button setSelected:![button isSelected]];
Yes, you need to respond to the touch up inside by setting the button to highlighted.
Btw, it's "disabled" not deselected, but it doesn't sound like you need that state.

UIActionSheet Button color problem

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

touch effect for Button in iphone

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!