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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:20:36+00:00 2026-06-12T21:20:36+00:00

I have an NSMutableArray full of UILabels and I want to modify the text

  • 0

I have an NSMutableArray full of UILabels and I want to modify the text attribute of them by stepping through the array. I know its not a problem with the UILabels or the function generating the text I want assigned to the labels as I have tested it outside of the array and it works fine. I just cant seem to get the text attribute to modify while the UILabel is inside of an array.

I have the array populated as below:

NSMutableArray *scrambledWordLabelArray;

-(void)initUIArrays {
    [scrambledWordLabelArray insertObject:ScrambledWordLabel1 atIndex:0];
    [scrambledWordLabelArray insertObject:ScrambledWordLabel2 atIndex:1];
    [scrambledWordLabelArray insertObject:ScrambledWordLabel3 atIndex:2];
    [scrambledWordLabelArray insertObject:ScrambledWordLabel4 atIndex:3];
    [scrambledWordLabelArray insertObject:ScrambledWordLabel5 atIndex:4];
    [scrambledWordLabelArray insertObject:ScrambledWordLabel6 atIndex:5];
}

Then once the view loads its supposed to change the labels to the strings generated by the other function:

- (void)viewDidLoad
{
    [super viewDidLoad];   
    [self initUIArrays];

    currentGameList = [self GetWordList:[self LoadWordlist]];

    for (NSUInteger i = 0; i < [currentGameList count]; i++) {

For this part I found two solutions, neither worked for me…

Solution 1:

         UILabel *temp = [scrambledWordLabelArray objectAtIndex:i];
         temp.text = [self ScrambleWord:[currentGameList objectAtIndex:i]];

Solution 2:

         [[scrambledWordLabelArray objectAtIndex:i] setText:[self ScrambleWord:[currentGameList objectAtIndex:i]]];
    }
}

Any help would be greatly appreciated because I’ve been researching and debugging for hours with no fix 🙁

  • 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-12T21:20:38+00:00Added an answer on June 12, 2026 at 9:20 pm

    You don’t initialize the scrambledWordLabelArray. You need to add the following line:

    scramledWordLabelArray = [[NSMutableArray alloc] init];
    

    On a side note:

    Is it true that currentGameList and scrambledWordLabelArray will always have the same number of elements? Your ‘for’ loop is based on the number of elements in the currentGameList yet you use the same index to get elements from the scrambledWordLabelArray.

    Both solutions you posted are basically the same code.

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

Sidebar

Related Questions

I have NSMutableArray* names , which contains NSStrings. I want to sort the array
I have an NSMutableArray of names. I want the pass the data (selected name)
I have an NSMutableArray which has five objects in it. I want to insert
I have a NSMutableArray called putNumberUsed. It contains the following objects @blah1,@blah2,@blah3,@blah4. I want
I have two NSMutableArray: arrayone and arraytwo arrayone and arraytwo are full of objects,
Say I have NSMutableArray *array1 with 10 objects. I want to create an *array2
I have NSMutableArray with different objects in it of different classes. Now I want
I have an NSMutableArray that I display through a table view. The problem is
I have Two NSMutableArray .My First Array contain 3 UIButtons along With Buttons Titles
I have an NSMutableArray full of NSDictionary objects. Like so NSMutableArray *names = [[NSMutableArray

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.