uibutton

Is it possible to change a bar button background image while we click on it?

I have a barbuttonitem which i have customised using a custom button with an image. I want to change this image everytime after I click it. Like on and off. Once I click it it will show OFF image. Then again it will go ON image. Is it possible? ...

Can't get programmatically made UIButton to work - iPhone

Here is the code I'm using: -(void)viewDidLoad { NSString *checkerPath = [[NSBundle mainBundle] pathForResource:@"black-yellow-checker" ofType:@"png"]; UIImage *checkerImage = [[UIImage alloc] initWithContentsOfFile:checkerPath]; checkerView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 230.0f, 320.0f, 280.0f)]; ...

Enable/Disable button using webViewDidFinishLoad

I'm working on an iOS app, and I need to prevent a UIButton from being usable until the page has finished loading (it uses resources that might not be on the page until it has loaded completely.) Right now, I've disabled the button in Interface Builder and am trying to use setEnabled in the webViewDidFinishLoad function. Here's what it ...

Adding stationary UIButton to UIScrollview

Hi, I am creating an app and on the third layer of the app, the view controller contains a UIScrollView with two images that scroll horizontally. I want to add a button to this view that is stationary with respect to the scroll view. So, the user can scroll the images but the button remains where it is. Is there a way for me to do this? ...

UIButtons programmatically added to UITableViewCell never appear

Trying to create a simple table full of buttons, where the buttons are generated at run-time; the table appears, and has the right number of rows etc., but the rows appear to be empty. public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { // The NavItem class is a "Josh Bloch enum" with...

How to make UIButton use a masked image correctly?

I’m creating a UIButton programmatically and then adding a masked image with setImage: CGRect photoFrame = CGRectMake(11, 11, 180, 120); UIButton *cardPhotoButton = [[UIButton alloc] initWithFrame:photoFrame]; cardPhotoButton.backgroundColor = [UIColor clearColor]; UIImage *cardPhoto = [[UIImage alloc] init]; cardPhoto = [self maskImag...

How can I safely memory manage a button that I want to remove from the UI?

I'm making an app that is kinda like iBooks. There is some stuff on the screen, each item represented by a small thumbnail. I want the user to be able to delete the items much like when you tap the "Edit" button in iBooks - an X comes up, and the item is deleted. I'm using the delegation pattern to handle all of this, so here is some cod...

Creating iOS UI components from NUnit test code

I'm trying to write a unit test for some code that programmatically creates UIButtons, but when I call this code from the test, I get a NullReferenceException. Stepping through in the debugger, it looks like UIButton.FromType() returns null. Here's the method I'm testing: public UIButton makeButton (String title, Action<IWelcomeCon...

Change Style/State of UIButton Info Dark

Hi all, I have a UIButton (Info Dark) which opens a small box on click. Is it possible to change the style/state the button so that the buttons appears highlighted or something like this as long as the box is open? Or do I have to use own background images for the button? ...

UIScrollView with UIButton doesn't scroll when touch down on button

Hi, I've got a UIScrollView in my UIView. I've added some UIButtons to the scroll view. If I touch down not on a button and drag, the scroll view drags fine. If I touch down on a button and drag then the scroll view doesn't move. I want the scroll view to always scroll around if dragged and the buttons only get selected on the Touch U...

UIButton event 'Touch Up Inside' not working. 'Touch Down' works fine.

Hi, I've got a UIButton in a UIView, which is in a UIViewController that I've allocated and inited from a .xib file. When hooking an IBAction up to the 'Touch Down' event of a UIButton it triggers correctly. But if I hook it up to the 'Touch Up Inside' event it doesn't respond. Other events don't work either. 'Touch Drag Enter', 'Tou...

UISwitch and UIButton in UITableViewCell, how to ident them

Hi, I've got a little problem in my UITableViewCell. Each Custom Cell have an UISwitch and an UIButton. And when the user change the value of the UISwitch i would like to set the button.hidden property to YES. I can find which UISwitch was clicked with this method: - (IBAction)closeHour:(id)sender { UISwitch *senderSwitch = (UISwitc...

iphone: how to add checkboxes to a uitableviewcell?

Hi, I just can't seem figure out how to do this hopefully someone here can help me. In my tableview i want to add checkboxes to each cell and if you touch the checkbox a checkmark appears and a specific action is supposed to happen. but if you just touch the cell a different action is supposed to happen. Does anyone have an idea how to d...

Memory Leaks in Irregularly Shaped UIButtons

I know this is a long-shot, but since I need this code to work, maybe someone here can help. I'm using the Irregularly Shaped Buttons code from CodeProject.com in one of my iPhone apps. Works great, but Instruments is reporting two memory leaks. I'm using the code in a standard UIViewController, but that is inside a UINavigationContro...

How to Change UIButton title ?

MyViewController has one UIButton and another MainViewController use MyViewController. but MainViewController can't change UIButton title in MyViewController. also, in MyViewController only change UIButton title in viewDidLoad method. What's wrong? MyViewController @interface MyViewcontroller : UIViewController { IBOutlet UIBu...

Animate multiple UIButtons

Hi I am beginner to iOS and I have a question. I want to re arrange multiple buttons when changing orientations so i have this code to create them : NSArray *buttonImages = [[NSArray alloc] initWithObjects:@"button_1.png",@"button_2.png", @"button_3.png", @"button_4.png", nil]; int xcord = 0; //int ycord = 0; UIInterfaceOri...

UIButton event 'Touch Up Inside' not working. 'Touch Down' works fine.

I've got a UIButton in a UIView, which is in a UIViewController that I've allocated and inited from a .xib file. When hooking an IBAction up to the 'Touch Down' event of a UIButton it triggers correctly. But if I hook it up to the 'Touch Up Inside' event it doesn't respond. Other events don't work either. 'Touch Drag Enter', 'Touch Dra...

How to associate a method with this button?

I have a navigation bar button that displays both image and text. This is the code: UIImage *saveImage = [UIImage imageNamed:@"star.png"]; UIButton *saveButton = [UIButton buttonWithType:UIButtonTypeCustom]; [saveButton setBackgroundImage:saveImage forState:UIControlStateNormal]; [saveButton setTitle:@"Save" forState:UIControlStateNor...

UIButton block equivalent to addTarget:action:forControlEvents: method?

I looked around, but couldn't find this on the internet, nor anywhere in the Apple docs, so I'm guessing it doesn't exist. But is there a iOS4 blocks equivalent API to: [button addTarget:self action:@selector(tappy:) forControlEvents:UIControlEventTouchUpInside]; I suppose this could be implemented using a category, but would rather ...

UIButton moving and touch

I've read several topics to moving a UIButton and can touch the button when its moving. Now i'm using a UIView beginAnimation, but the button can't be touched when its moving. I've also read something about a NSTimer, but this is not the best way to do in my project. Is there another way, someone has the same problem? Thanks for any h...