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 8717501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:19:14+00:00 2026-06-13T06:19:14+00:00

I basically want to send a known string from a method I am in:

  • 0

I basically want to send a known string from a method I am in:

    NSString *websiteString;
    if(a==0)
          websiteString = [[[NSString alloc] initWithString:@"www.google.com"] autorelease];

    else
          websiteString = [[[NSString alloc] initWithString:@"www.yahoo.com"] autorelease];

    UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
    aButton.frame = rct;

    // I get thrown in this next line: how do I initialize the Value for key?
    [aButton setValue:websiteString forKey:@"website"];
    [aButton addTarget:self action:@selector(clickedInsidePage:) forControlEvents:UIControlEventTouchUpInside];

To the callback function, where I can load the sent string in the UIWebview…

-(void) clickedInsidePage:(id) sender{

   NSString *websiteString = [[[NSString alloc] initWithString:[((UIControl *) sender) valueForKey:@"website"]] autorelease];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:[NSURL URLWithString:websiteString]];
    NSLog(@"visiting: %@",websiteString);
    .
    .
    .

    }

But I get an error thrown because the key/Value was not actually set or initialized.

  • 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-13T06:19:15+00:00Added an answer on June 13, 2026 at 6:19 am

    You could have an array of strings, then give the button tag property the index. Then you can extract the tag to get the string:

    NSArray * someArray = // website strings added here
    

    In your if statement, set the button to match the index:

    aButton.tag = 0;
    

    Then use the index to get the string:

    string = [someArray objectAtIndex: ((UIButton*)sender).tag];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new with cron job in php,basically i want to send email to
I have this form. Basically what I want is to send a auto-response with
I basically want to open a browser window from Word using VBA that does
I want to use wp_remote_post to send information from one server to my other
I want to Use Some Java Code From the WCF Service. Basically I need
I want to send and receive some data from my server, but I don't
I basically want something like: TextView Button Button . . . TextView TextView SeekBar
I basically want to setup a relationship similar to Netflix's DVD rental model. There
I basically want to do: git checkout branchA git checkout -b branchB <commit_id> which
I basically want the same functionality as facebook, twitter and all those other infinite

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.