Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-16-2011, 04:52 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 112
Pjgdog is on a distinguished road
Default Making A button dissapear

Hi I was wondering How I could make a button dissapear after hitting the redeem button on my UIAlert View here is my code



- (IBAction)pushButton: (id)sender
{

//Freebies Redeem Alert
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Your Redeeming A Freebie" message:@"Press Redeem To recieve your Service" delegate:self cancelButtonTitle:@"No Thanks" otherButtonTitles:@"Redeem", nil];
[alert show];
[alert release];
}


#pragma mark -
#pragma mark - UIAlertViewDelegate



- (void)alertView: (UIAlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex
{
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 1)
{
//NSLog(@"ok");
UIImage *img = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image1bw" ofType:@"png"]];
[image1bw setImage:img];
[img release];


}

else (buttonIndex == 0);
{
//NSLog(@"cancel");
}
}
Pjgdog is offline   Reply With Quote
Old 02-16-2011, 05:31 PM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

Making what button disappear?
baja_yu is offline   Reply With Quote
Old 02-16-2011, 05:58 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 651
kapps11 is on a distinguished road
Default

did search at all for this?

[button setHidden:YES];

orrrrrrr [button removeFromSuperView];
kapps11 is offline   Reply With Quote
Old 02-16-2011, 06:05 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2011
Location: South Florida, US
Posts: 357
lgehrig1 is on a distinguished road
Default

Quote:
Originally Posted by kapps11 View Post
did search at all for this?

[button setHidden:YES];

orrrrrrr [button removeFromSuperView];
I'd recommend the setHidden, since I take it you're trying to prevent the user from smashing the "submit" button a bunch of times. With hidden you can pop it right back once you've completed your logic.
lgehrig1 is offline   Reply With Quote
Old 02-16-2011, 06:09 PM   #5 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

I commented on this before but you seem to be posting the code again.

Code:
else (buttonIndex == 0);
{
//NSLog(@"cancel");
}
Is that even compiling? There's no expression after if and certainly no semi-colon.

Also, please use [code] [/ code] tags when posting code from now on. It makes it much easier to read.
baja_yu is offline   Reply With Quote
Old 02-16-2011, 08:53 PM   #6 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 44
tomDev is on a distinguished road
Default

If I just want to a button to dissapear, I just change the Alpha of the button.

Code:
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1.0];
	[button1 setAlpha:1.0];
	[UIView commitAnimations];
Just put this code on the action, when you push the button it will slowly go away. And of course create an IBOutlet UIButton and connect on the IB.
tomDev is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 368
10 members and 358 guests
cpsclicker, Error404, gmarro, jeroenkeij, Kirkout, Music Man, PavelMik, teebee74, whitey99
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,666
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, cpsclicker
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:07 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0