Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8828791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:41:17+00:00 2026-06-14T07:41:17+00:00

I created an alert view with three buttons -Sign Up,Donate,Cancel- when u click on

  • 0

I created an alert view with three buttons -“Sign Up”,”Donate”,”Cancel”- when u click on either sign up or donate, safari should open with the specific website. However when I open the app, and click any of the buttons, safari doesn’t open or do anything and the buttons work as though they were different versions of the cancel button. Here is my code:

In BlahBlah.h:

@interface BlahBlah: UIViewController <UITextFieldDelegate, UIAlertViewDelegate> {
}
@end

In BlahBlah.m:

#define donate_tag 0
#import "BlahBlah.h"
@implementation BlahBlah
...
- (void) donate {
UIAlertView *alert2  = [[UIAlertView alloc] initWithTitle:@"Donate"
message:@"Function doesn't work yet :(" delegate:nil cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Sign Up",@"Donate",nil];
alert2.tag = donate_tag;
[alert2 show];
[alert2 release];
}
...
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

if(alertView.tag == donate_tag && buttonIndex == 1){
   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];
  }
else if(alertView.tag == donate_tag && buttonIndex == 2){
   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.yahoo.com"]];
  }
}
...
@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:41:18+00:00Added an answer on June 14, 2026 at 7:41 am

    You need to tell the alert who handles the actions of the buttons, that is to say, who is the “delegate” of the alert view.

    Since everything related to the UIAlertView is within your “BlahBlah” view controller, after creating alert2, do something like this:

    alert2.delegate = self;
    

    or declare it in your UIAlertView instantiation:

    UIAlertView *alert2  = [[UIAlertView alloc] initWithTitle:@"Donate" 
        message:@"Function doesn't work yet :(" delegate:self 
        cancelButtonTitle:@"Cancel" otherButtonTitles:@"Sign Up",@"Donate",nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im planning to create an Alert view with three buttons, my problem is I
I have created an alert view with two buttons using the following code: UIAlertView
I want to create a custom alert view within my iOS application. For example,
Possible Duplicate: Create an alert on any view controller after Facebook request:didFailWithError: I have
the javascript:alert code that is being dynamically created ONLY works if I use the
I want to create an alert box with 3 radio buttons in it. It
I've created my own split view controller for the iPad. My main purpose in
I have created a view and a controller, the controller I am wanting to
I'm trying to dynamically create alert messages using the jQuery plugin for Bootstrap CSS.
I have a Login dialog that can create an alert dialog when the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.