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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:49:20+00:00 2026-05-25T06:49:20+00:00

I’m creating draggable letter tiles for all the letters in the alphabet. I’m creating

  • 0

I’m creating draggable letter tiles for all the letters in the alphabet. I’m creating 5 of each letter in the case that a word requires more than one of the same letter.

I’m programmatically creating each UIImageView in my MainViewControllers ViewDidLoad: method.

- (void)ViewDidLoad:
{
        for (int i = 1; i <= 5; i++)
    {
        letterA = [[LetterTiles alloc] initWithFrame:CGRectMake(39, 104, 70, 70)];
        [letterA setImage:[UIImage imageNamed:@"a.png"]];
        letterA.tag = i;
        [letterA setUserInteractionEnabled:YES];
        [self.view addSubview:letterA];
        [letterA release];

    for (int i = 1; i <= 5; i++)
    {
        letterB = [[LetterTiles alloc] initWithFrame:CGRectMake(112, 104, 70, 70)];
        [letterB setImage:[UIImage imageNamed:@"b.png"]];
        letterB.tag = i;
        [letterB setUserInteractionEnabled:YES];
        [self.view addSubview:letterB];
        [letterB release];
    }

    for (int i = 1; i <= 5; i++)
    {
        letterC = [[LetterTiles alloc] initWithFrame:CGRectMake(185, 104, 70, 70)];
        [letterC setImage:[UIImage imageNamed:@"c.png"]];
        letterC.tag = i;
        [letterC setUserInteractionEnabled:YES];
        [self.view addSubview:letterC];
        [letterC release];
    }   
}

I have a few questions:

  1. Should I be creating an array for each letter, or creating a single array for all the letters?

  2. What kind of array should I be using? NSMutableArray/NSArray or NSMutableDictionary/NSDictionary? -I have been trying to figure out how to add all these letters to all the above array types, then retrieve them based off their letter and tag, but cannot for the life of me figure it out. Would someone be willing to show me an example with one or two of the letters in code?

  3. Is there a better way to do this than what I’m showing and asking here?

  • 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-25T06:49:20+00:00Added an answer on May 25, 2026 at 6:49 am

    Question 1

    Having a single NSArray for all the letters is better, it reduces the amount of variables you’ll have to deal with. Having something like this:

    NSArray *arrayA;
    NSArray *arrayB;
    NSArray *arrayC;
    ...
    NSArray *arrayZ;
    

    Is just a lot of code for something that can be made readily accessible in a single data structure, not to mention, easier to update if you plan on adding numbers, puncutation, etc.

    Question 2

    Mutable means that it can be updated, so the important question, should your Array/Dictionary update on runtime? If the answer is no, a non-mutable array might be better. On the other hand, you’ll have to automatically fill the array with a lot of stuff, so having a mutable version may allow you to have cleaner code (Instead of having a [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"A"], ...]).

    So I would go with the mutable version, just for cleaner code.

    Question 3

    This is a personal choice, but I’m not a big fan of having nested data structures in statically typed languages (Doing this in python is a bliss, for instance myDictArray["key"][1]). I would use a Mutable Dictionary, where the keys are composed, to store the pertinent data:

    NSString *key = [NSString stringWithFormat:"%c%d", letter, number]; // For example "J3" is the 3rd J letter.
    

    On the other hand, instead of using images, I would use big square UILabels, to save up in memory (and mental sanity, dealing with that many images, ugh), and pick one of the many fonts that iOS uses (Here’s a complete list).

    With this, generating everything, would require two nested fors, one to iterate through each letter, and then one for each 5 repetitions, and then create the label and throw it inside the dictionary (I would write code, but I’m not on a mac).

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I have an autohotkey script which looks up a word in a bilingual dictionary

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.