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

  • Home
  • SEARCH
  • 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 3214410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:03:27+00:00 2026-05-17T15:03:27+00:00

I am doing an application on a Multiple Choice Question (MCQ) where I have

  • 0

I am doing an application on a Multiple Choice Question (MCQ) where I have to get questions, answers from a webservice. I have 1 question with 4 options, among the 4 options, I have 1 correct answer. Each of the options, I created a button programmatically. This is how I did it:

    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(40, yButton, 30, 30);
    [button setTitle:@" " forState:UIControlStateNormal];

[button addTarget:self action:@selector(correctPressed)
 forControlEvents:UIControlEventTouchDown];
   [buttonArray addObject:button];

How many options I have in a questions will determine how many buttons will be created. Now when I want to show an indication that when a certain button is clicked, that button needs to stay highlighted until I decides to change my answer. I have done a few approaches.

I used IndexPath, hoping I could use indexPath.row like in TableView. It didnt work out at all. Can anyone help?

Thanks

  • 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-05-17T15:03:28+00:00Added an answer on May 17, 2026 at 3:03 pm
    for(int i=0; i<[videolistArray count];i++){
    
    
        NSArray *myWords = [[[videolistArray objectAtIndex:i] valueForKey:@"video"] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];
        //NSLog(@"%@",[myWords lastObject]);
    
        UIButton *guitaristButton = [[UIButton alloc]init];
        guitaristButton.frame = CGRectMake(0, ycomp, 300, 35);
        guitaristButton.tag = i;
        [guitaristButton setBackgroundImage:[UIImage imageNamed:@"green-buttons.png"] forState:UIControlStateNormal];
        [guitaristButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [guitaristButton setTitle:[myWords lastObject] forState:UIControlStateNormal];
        [guitaristButton addTarget:self action:@selector(VideoButtonSelected:) forControlEvents:UIControlEventTouchUpInside];
        //[guitaristButton performSelector:<#(SEL)aSelector#> withObject:<#(id)object1#> withObject:<#(id)object2#>
        [videoScrollView addSubview:guitaristButton];
        [guitaristButton release];
    
        ycomp = ycomp+35;   
    }
    videoScrollView.contentSize=CGSizeMake(300, ycomp);
    

    }
    -(void)VideoButtonSelected:(UIButton*)sender{
    NSArray *myWords = [[[videolistArray objectAtIndex:sender.tag] valueForKey:@”video”] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@”/”]];
    //NSLog(@”%@”,[myWords lastObject]);
    [setAlarmVedioButton setTitle:[myWords lastObject] forState:UIControlStateNormal];
    [videoNameButtonView removeFromSuperview];
    vedioString=[[videolistArray objectAtIndex:sender.tag] valueForKey:@”video”] ;
    }

    in above code me make uibutton with help of array count and when i select any button then it display the same text value of array on last button

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing an application where there will be multiple items displayed on a
I have an application that manages multiple magazine PDFs on the hard drive. I
I have an application that posts to multiple Twitter accounts by storing an array
I must build a Application that will use Webclient multiple times to retrieve every
I am writing an application that uses UIImagePickerController to take multiple pictures with the
I have developed an application which allows the user to switch between themes. I'm
I need the above data structure for an application I'm writing. I wondered if
I'm trying to embed a browser control in my application (IWebBrowser2). I need to
I am trying to write a module for a Java application that accesses a
Right now my login system is the following: Password must be at least 8

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.