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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:00:16+00:00 2026-05-26T01:00:16+00:00

I successfully created a UIscrollview (horizontal) for 50 images and also created a label

  • 0

I successfully created a UIscrollview (horizontal) for 50 images and also created a label of “1 of 50” page number displaying at the top of the image along with the scroll view(for example user scroll to next image it would show 2 of 50, 3 of 50, so forth). I am able to display a label at the bottom of the image as a description. My problem is how can I create or code to display different description for each image? Im thinking of NSarray but it shows some random numbers. Is there a sample I can look at to see what I am doing wrong. you can see the description part where I am lost from there. Thanks =)

    CGFloat xOffset = 0;
        NSInteger pageNumber = 1;
            NSUInteger i;
        for (i = 1; i <= 5; i++)
        {
            NSString *imageName = [NSString stringWithFormat:@"creative%d.jpg", i];
            UIImage *image = [UIImage imageNamed:imageName];
            UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

            [imageView setFrame:CGRectMake(xOffset, 0, 320, 288.5)];
            [ourScrollView addSubview:imageView];
            [imageView release];

            UILabel *pageNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(xOffset, -10, 320, 40)];
            [pageNumberLabel setText:[NSString stringWithFormat:@"%d of 5", pageNumber]];
            [pageNumberLabel setTextAlignment:UITextAlignmentLeft];
            [pageNumberLabel setTextColor:[UIColor whiteColor]];
                    [pageNumberLabel setBackgroundColor:[UIColor clearColor]];
                    [pageNumberLabel setFont:[UIFont fontWithName:@"MarkerFelt-Thin" size:18]];
            [ourScrollView addSubview:pageNumberLabel];
            [pageNumberLabel release];

  NSArray  *description = [NSArray arrayWithObjects:@"wow", @"bam", @"pow", @"zing", @"bling",nil];                 

                    UILabel *descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(xOffset, 250, 320, 40)];
                    [descriptionLabel setText:[NSString stringWithFormat:@"%@", description]];
                            [descriptionLabel setTextAlignment:UITextAlignmentLeft];
            [descriptionLabel setTextColor:[UIColor whiteColor]];
                    [descriptionLabel setBackgroundColor:[UIColor clearColor]];
            [ourScrollView addSubview:descriptionLabel];
            [descriptionLabel release];

            xOffset = xOffset + 320;
            pageNumber = pageNumber + 1;
  • 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-26T01:00:17+00:00Added an answer on May 26, 2026 at 1:00 am

    You’re setting the descriptionLabel with a format of @"%d", which is a decimal format. What is “description”? If it’s a NSString then you should be using @"%@".

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

Sidebar

Related Questions

I've successfully created an NSCollectionView and added a label to the view prototype in
I Successfully created an user control for displaying Error message. now everything works fine
I have successfully created a number of UserControls with various functionality setting the DataContext
I have successfully created EditTexts depending on the user input in Android, and also
I successfully created a WebGL texture from an image and drew it into a
I have successfully created video from images using the following code -(void)writeImageAsMovie:(NSArray *)array toPath:(NSString*)path
I have successfully created an app that reads from a bundled .plist file and
So I'm a newbie to TDD, and I successfully created a nice little sample
I've created my own WCF service and I've successfully been able to talk to
I created a google app engine project. I just successfully mapped it to a

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.