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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:58:12+00:00 2026-05-28T04:58:12+00:00

I added a UILabel subview using code. When the user rotates the iPad, I

  • 0

I added a UILabel subview using code. When the user rotates the iPad, I want to be able to tell that UILabel to shift its position to accomodate the new screen orientation.

I think I need to put my code in the willAnimateRotationToInterfaceOrientation function.
I want to be able to get at my UILabel and I see sample code that looks like the following to retrieve a reference to a subview:
UILabel *myLabel = (UILabel *) [self.subviews objectAtIndex:0];

How do I know what index my UILabel is at? The sample code seems to know that their subview is the first one (index 0).

Is there a way for me to find out what my UILabel’s index is?

Is there another way to keep a reference to this UILabel that I create in code? If I made myLabel a variable of the class, will I be able to reference

  • 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-28T04:58:13+00:00Added an answer on May 28, 2026 at 4:58 am

    Generally, in your UIViewController, you’d have an instance variable that was a pointer to your UILabel. Then you can access it anywhere in your controller’s code.

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

Sidebar

Related Questions

I have an UIButton to which an UILabel was added as a subview. Is
I am implementing a UIlabel that displays the result of a user's button clicks
I have added a UILabel to my view programmatically like this: myLabel = [[UILabel
ADDED: This question is now, I believe, subsumed by this one: Using GNU Screen
I added some simple WatiN tests to our app today to check that a
I added a text file to a testapp's solution and I want to read
I am adding a UILabel as a subview to a UIView and sometime later
I created UINavigationController application. I added UILabel to UINavigationBar, but there is a problem.
I have the following code... UILabel *buttonLabel = [[UILabel alloc] initWithFrame:targetButton.bounds]; buttonLabel.text = @Long
For one of my application, I have added UILabel to the UITableView header section.

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.