uibutton

How do I scale a UIButton's imageView?

Hey guys! I create a UIButton instance(named "button") with a image use [UIButton setImage:forState:] function, the button.frame is larger than the image's size. Now I want to scale this button's image smaller. I had tried to change button.imageView.frame, button.imageView.bounds and button.imageView.contentMode, but all seem ineffective...

UIControl - changing assigned selectors: addTarget & removeTarget

I'm using 10 buttons in my interface and need, from time to time, to change the button's selector. Am I required to use: -(void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents before I change the selector or can I just use: -(void)addTarget:(id)target action:(SEL)action forControlEvents:(...

UIScrollView and UIButton, UIButtons Disappearing

I have an UIScrollView where I create two buttons. The first button works as it should, however the second button disappears. It is still there and can accept clicks, and becomes visible when you click on the hidden button. Any idead on why the second button dis appears? cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellSty...

image not showing in UIBUtton

I'm writing a small application that allows for patterns to be placed on a button. When I run the app in the simulator the patterns display ok on the button. When I compile the application to the device the patterns do not display on the buttons but all other logic behind the buttons works fine. The patterns are simple png images and I ...

set custom uibuton look like iPhone UI without an image

Hello everyone, does anyone have the code to emulate the iPhone's look and feel of the UIButton programmatically or through interface builder. To be more exact I would like to emulate the cancel and ok buttons of this image: http://www.machwerx.com/wp-content/uploads/2009/10/password.png I don't know why it's not built into the SDK. I ...

iPhone UIButton buttonType always evaluates to 0?

Whenever I execute the code below I always get button type = 0 no matter what I specify for buttonWithType. Does anyone know an explanation for this behavior? I'm trying to distinguish button based on their type obviously without success since the buttonType property appears to be broken (or useless). As always thanks very much for an...

Interface Builder (iPhone dev) custom button background Image does not respect Stretching settings

I'm attempting to create a custom button using a background image in Interface Builder. The image has stretchable and non-stretchable parts so that it can be resized. IB exposes the Stretching properties to allow for this, yet no values I put in affect how the button appears. It is always fully stretched to fill the size of the frame....

iPhone - UIButton background image is cut off sometimes

Hi I am using a custom image as the background image for my buttons. I have noticed that the edges of the buttons are cut off sometimes. My buttons vary in size but the behavior doesn't seem to be dependent on the button size. I am creating the buttons programatically. The image I am using is pretty large to cover the entire background....

How to add (id) sender to the following -(IBAction)?

How do you add a (id) sender to the following code? - (IBAction) gobutton: (UIButton *) button5 { Everything I try fails, any help would be appreciated. Thanks. EDIT: I need to keep the (UIButton *) button 5 reference in the (IBAction) ...

Prevent disabled UIButton from propagating touch events

My application has two overlapping UIButtons. The top button may be disabled at times. However, in this case any touch events it receives seem to be passed down to the underlying view, which in my case is the other button. What I need is the top button intercepting all touches and preventing them from reaching the bottom button, even in...

UISegmentedControl delegate/Touch Events

I have a UISegmentedControl that has six segments, I want them to call a method when the value changes, but also when each segment gets a UIControlEventTouchDragIn because I want a UILabel to show up with it's name when the person is trying to select something on it and drags their finger across the control, but the segmented control doe...

UIButton how to remove from UIView?

Hey guys, I've set up a Button and add it to a view. I want to add a "done" button to the UIKeyboardTypeNumberPad. Here's my code. UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom]; doneButton.frame = CGRectMake(0, 163, 106, 53); doneButton.adjustsImageWhenHighlighted = NO; [doneButton setImage:[UIImage im...

iPhone UIButton Parent Frame Changing Touch Up Inside Event Issue

I have a UIButton within a UIView. The button is docked on the bottom of the view using the Autoresizing Masks. The button is working fine when the view initially loads and the IBAction is being called successfully. Now when I resize the height of the parent view the button stays docked at the bottom of the view, however now only half...

EXC_BAD_ACCESS with IBACTION

Hello. I have read a lot about this issue but mine still seems to be different somehow. So from what I understood, EXC_BAD_ACCESS occurs with memory management problems. The thing is, mine does not seem (! :)) to be there. The thing is, I simple added a button in IB, rounded rect, no image. The I hooked it up with an IBACTION I defined...

How to save Data in text file when user chooses a button

I want to have user select between two different buttons on a view, If the the user selects the imageOne, a label is created called "imageOne", then I'll save the label into an array using the following technique: - (IBAction)saveData { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)...

iPhone - How to play a sound on button touch?

I'm trying to make a button play a sound upon touching the button. I can get the sound to play with the Touch Up Inside option but that's not what I'm looking for because the sound only plays after the button is released. I've tried to use touchesBegan to play the sound upon touching the button but it doesn't seem to work. Any ideas wh...

Coloration of UIButtons of type UIButtonTypeRoundedRect

I would like the rounded rectangle portion of the subject type of UIButton to be a solid custom color I specify. I understand that . setTitleColor : changes the text color . backgroundColor : changes the color of the four pie-shaped corner pieces behind the rounded rectangle The question is how to change the color of the rounded recta...

UITextField - Switch Between Keyboard and UIPickerView

Hi all, I'm working on an iPhone app that uses Core Data. One of the view controllers allows the user to edit information about coffee, and it has a UITextField in which the user can enter one descriptive "tag" for the type of coffee. I'd like to set up the UITextField to show the keyboard if the user clicks into the main area of the U...

How do I push a new controller via UIButton, nested in a UIScrollView?

Hello - I have my views that are part of a tabBar. Each view has a navigationController. In one of my views I have an embeded xib component. This is a scrolling view with UIButtons inside it. I want to slide in another view, inside the navigationController when a person taps the button. I can get the taps, etc. BUT, I can't figure o...

Buttons and Cartesian Coordinates

Hi, I have this scrollview "eager" to be filled up with buttons (4 per row), and resembling iphone apps icons, I want the user to be able to rearrange them has she/he pleases. If it were one row of buttons only, Apple Autoscroll tutorial app would be an excellent example to follow. Not the case, this is 2D and I cannot figure out how to...