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 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 have a medium size legacy php application with almost no javascript integration. I've
I am doing Multimedia application using client server interaction, for that i uploaded some
Let's say that you want to write an application that processes multiple text files,
In my application I am using ContextLoaderListener to load context files from many jars
I'm doing a little offline shopping cart application here with Delphi and I'm stuck.
I have the following tables: Application Component Position An Application can have 1 to
I have an application (cad like editor) in which the user may place a
I'm currently working on an application that uses php's simplexml to interpret rss feeds
I'm attempting to create a process that verifies data within a database and notifies

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.