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 06-01-2010, 07:28 PM   #1 (permalink)
Banned
 
Join Date: Jun 2010
Posts: 91
maxk77 is on a distinguished road
Default UIAlert View Donation

Hi, i have made an alert view with 2 buttons one saying done and one saying donate. How do i link up the donate button to goto paypal.com? Here is my source code.
Code:
- (IBAction)aboutPressed:(id)sender;
{
	UIAlertView *startAlert = [[UIAlertView alloc] initWithTitle:@"Information" message:@"If you have any problems with this application feel free to email me at sdk4you@gmail.com and please donate." delegate:nil cancelButtonTitle:@"Done" otherButtonTitles:@"Donate", nil];
	[startAlert show];
	[startAlert release];
}
maxk77 is offline   Reply With Quote
Old 06-01-2010, 07:44 PM   #2 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

It took Google 0.23 seconds to fine this thread. That's how you find out which button was pressed. Another stunning 0.18 seconds for Google to find out how to open URLs.

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-01-2010, 07:46 PM   #3 (permalink)
Banned
 
Join Date: Jun 2010
Posts: 91
maxk77 is on a distinguished road
Default

i have searched and tried those ways its just defining which button to be used which is striking me with dificulty
maxk77 is offline   Reply With Quote
Old 06-01-2010, 08:09 PM   #4 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

I don't quite understand. The first thread I linked to has sample code that you have to implement. Stitch's post explains what you need to do. What are you having problems with?

And more importantly, what have you tried? Why did it not work?

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-01-2010, 08:13 PM   #5 (permalink)
Banned
 
Join Date: Jun 2010
Posts: 91
maxk77 is on a distinguished road
Default

i have tried [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];

and this -(void)alertViewUIAlertView *)alertView clickedButtonAtIndexNSInteger)buttonIndex {
if(buttonIndex == 1) {
NSURL *myURL = [[NSURL alloc] initWithString:@"http://www.jashsoft.com/"];
[[UIApplication sharedApplication] openURL:myURL];
}
}

i dont know where i am going wrong please could you tell me what i need to do as you obviously know.
maxk77 is offline   Reply With Quote
Old 06-01-2010, 08:19 PM   #6 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

The method
- (void)alertViewUIAlertView *)actionSheet clickedButtonAtIndexNSInteger)buttonIndex { }
detects which button was pressed on your AlertView. You need to implement the delegate protocol in your header file (see Stitch's post in the linked thread). Depending on whether you "donate" button has index 0 or 1, you need to adjust the if-statement in alertView:clickedButtonAtIndex: to match your "donate" button.

I don't know what you are missing? What did you put the code? What does it stop working? You are not really giving me much information to work with here... I cannot read your mind or code that you didn't post here.

Cheers,
Bob

P.S.: Please use code-tags -- they make your code a lot easier to read.
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-01-2010, 08:25 PM   #7 (permalink)
Banned
 
Join Date: Jun 2010
Posts: 91
maxk77 is on a distinguished road
Default

this is my code:
Code:
#import "TimerAppDelegate.h"

@implementation TimerAppDelegate 
- (IBAction)aboutPressed:(id)sender
{
	UIAlertView *startAlert = [[UIAlertView alloc] initWithTitle:@"Information" message:@"If you have any problems with this application feel free to email me at sdk4you@gmail.com and please donate." delegate:self cancelButtonTitle:@"Done" otherButtonTitles:@"Donate" , nil];
	- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
	if (buttonIndex == 1)
	{
		[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];
	}}
	[startAlert show];
	[startAlert release];
}
and i am getting the errors "alert view undeclared" and error expected ; before :


Quote:
Originally Posted by Robert Paulson View Post
The method
- (void)alertViewUIAlertView *)actionSheet clickedButtonAtIndexNSInteger)buttonIndex { }
detects which button was pressed on your AlertView. You need to implement the delegate protocol in your header file (see Stitch's post in the linked thread). Depending on whether you "donate" button has index 0 or 1, you need to adjust the if-statement in alertView:clickedButtonAtIndex: to match your "donate" button.

I don't know what you are missing? What did you put the code? What does it stop working? You are not really giving me much information to work with here... I cannot read your mind or code that you didn't post here.

Cheers,
Bob

P.S.: Please use code-tags -- they make your code a lot easier to read.
maxk77 is offline   Reply With Quote
Old 06-01-2010, 08:27 PM   #8 (permalink)
Banned
 
Join Date: Jun 2010
Posts: 91
maxk77 is on a distinguished road
Default

here is the .h and .m
Attached Files
File Type: zip Archive.zip (2.3 KB, 10 views)
maxk77 is offline   Reply With Quote
Old 06-01-2010, 08:32 PM   #9 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

Attachments don't work in this forum. (God knows why.) You'll need to upload it somewhere else.

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-01-2010, 08:34 PM   #10 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

Ah, okay. Well, the problem is that you declare a new method within an existing method! Your code should read:

Code:
- (IBAction)aboutPressed:(id)sender
{
	UIAlertView *startAlert = [[UIAlertView alloc] initWithTitle:@"Information" message:@"If you have any problems with this application feel free to email me at sdk4you@gmail.com and please donate." delegate:self cancelButtonTitle:@"Done" otherButtonTitles:@"Donate" , nil];
	
	[startAlert show];
	[startAlert release];
}

- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
	if (buttonIndex == 1)
	{
		[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];
	}
}
Those are separate methods, you see?

Hope this helps.

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-01-2010, 08:34 PM   #11 (permalink)
Banned
 
Join Date: Jun 2010
Posts: 91
maxk77 is on a distinguished road
Default

Archive.zip

Quote:
Originally Posted by Robert Paulson View Post
Attachments don't work in this forum. (God knows why.) You'll need to upload it somewhere else.

Cheers,
Bob
maxk77 is offline   Reply With Quote
Old 06-01-2010, 08:48 PM   #12 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

Looking at your .m file I see the following problem: The methods need to be placed after the @synthesized line.

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-01-2010, 08:59 PM   #13 (permalink)
Banned
 
Join Date: Jun 2010
Posts: 91
maxk77 is on a distinguished road
Default

thanks so much for all your work and hopefully you wont mind helping me some more later thanks soo much again.

max
Quote:
Originally Posted by Robert Paulson View Post
Looking at your .m file I see the following problem: The methods need to be placed after the @synthesized line.

Cheers,
Bob
maxk77 is offline   Reply With Quote
Old 06-01-2010, 09:08 PM   #14 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

Glad I could help.

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Reply

Bookmarks

Tags
alertview, donate, iphone, uialert, uibutton

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: 344
13 members and 331 guests
ajay123123, Anwerbl, ashaman64, baja_yu, ChrisYates, HemiMG, mini998, mottdog, newDev, Objective Zero, oceanlablight, pkIDSF, Steven.C
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,878
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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