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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:09:41+00:00 2026-06-04T07:09:41+00:00

I have an NSMutableArray with 3 UIButtons and Second NSMutableArray with 50 UIButtons. I

  • 0

I have an NSMutableArray with 3 UIButtons and Second NSMutableArray with 50 UIButtons. I want to take these 3 UIButtons Titles to Assign it Character by Character to each UIButton of SecondArray.but Each of these 50 UIButtons of Second Array already have single Character.My Basics purpose is that first of all i want to check the length of each uibutton title of my first Array,then assign it to index by index to UIButton in Second Array.(For Exp if my first Button have titles “stack”,second “over” and Third “flow” no i want to Assign UIButtons of index 0-5 ,13-16,35-38 in Second Array) .My first Array that have 3 UIBttons .here is code.

NSMutableArray *buttons = [NSMutableArray arrayWithObjects:btn1, btn2, btn3, nil];
            [btn1 setTitle:@"stack" forState:UIControlStateNormal]; 
            [btn2 setTitle:@"over" forState:UIControlStateNormal]; 
            [btn3 setTitle:@"flow" forState:UIControlStateNormal]; 

Here is my code.To create 50 UIButtons.

 -(void)button:(id)sender {
  saveBtn = [[NSMutableArray alloc] init];
  arr=[[NSArray alloc]
  initWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",
     @"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z",nil];

    for (int i=0; i<50; i++) {
            btn = [UIButton   buttonWithType:UIButtonTypeRoundedRect];
            btn.frame = CGRectMake(spacex, spacey, 30.0, 30.0);
            int idx;
            idx = arc4random()%[arr count];
            NSString* titre = [arr objectAtIndex:idx];
            [btn setTitle:titre forState:UIControlStateNormal];   
            spacex = spacex + 30;
            [saveBtn addObject:btn];
            [self.view addSubview:btn];

        }


            }

Any one guide me how can i assign my UIButton Titles to these UIButtons on Specific Index. Thanx

  • 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-04T07:09:42+00:00Added an answer on June 4, 2026 at 7:09 am

    Thanx for helping Every one ..but i done it here is code.my be it help some one others.

     - (void)getbuttontitle {
       for(int i = 0;i<[buttons count];i++)
      {
         if(i == 0)
        {
         UIButton *b1 = [buttons objectAtIndex:0];
          a = (NSString *)[[b1 titleLabel] text];
            [storewords addObject:a];
            NSLog(@"b=%@",a);
            }
        else if(i == 1)
        {
    
        }
        else if(i == 2)
        { 
    
        }
     }
    }
    
        for (NSString *str in storewords) {
            if (str==a) {
                int j = 0;
                int randn= (arc4random()%5)+1 ;
                NSLog(@"n=%d",randn);
                for (int i=randn; i<[a length]+randn; i++) {
                    NSLog(@"a=%@",a);
                    NSString *ichar  = [NSString stringWithFormat:@"%c", [a characterAtIndex:j]];
                    UIButton*  b = [saveBtn objectAtIndex:i];
                    NSLog(@"a=%@",ichar);
                    j++;
                    [b setTitle:ichar forState:UIControlStateNormal]; 
                }   
            }
    
            if (str==c) {
    
    
            }   
    
            if (str==d) {
    
            }       
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Two NSMutableArray .My First Array contain 3 UIButtons along With Buttons Titles
I have an array of UIButtons . What I want to do is with
I have an Array with 26 Alphabets and Second Array with 3 UIButtons. I
I have an NSMutableArray. It's members eventually become members of an array instance in
I'm currently dynamically creating UIButton objects in my view. I have an NSMutableArray containing
I have an NSMutableArray filled with Task objects. I want to be able to
in my .h I have IBOutlet NSMutableArray *buttons; @property (nonatomic, retain) IBOutletCollection(UIButton) NSMutableArray *buttons;
I have NSMutableArray with different objects in it of different classes. Now I want
I have NSMutableArray which contains NSObjects. Each NSObject contains a NSString as property which
I have a NSMutableArray which i am initializing from a plist with strings. but

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.