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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:52:56+00:00 2026-05-15T19:52:56+00:00

I’m having kind of a dumb problem. I am using the below code to

  • 0

I’m having kind of a dumb problem.

I am using the below code to create/modify a UILabel via code. The reason I am creating it via code is because I need it to be rotated 90 degrees and Im not aware of a way to do that in IB.

What’s happening – A user hits a button that makes the text they selected to appear in the UILabel. Then when they select the button again, with different text, the new text appears in place of the old text.

The first time I hit the button, it works perfectly, but the second time I hit the button, the new label appears over the old label and the old label never disappears. I have tried removing the first label, making it nil, just removing the text, but I cannot access any part of the label once it has been created.

ViewController.h

…
UIView *viewForLabels;
UILabel *tab1Label;
}
@property (nonatomic, retain) IBOutlet UIView *viewForLabels;
@property (nonatomic, retain) IBOutlet UILabel *tab1Label
…

@end

ViewController.m

…

@synthesize tab1Label;

…

UILabel *tab1Label = [[UILabel alloc]init];

tab1Label.text = [theText];
tab1Label.backgroundColor = [UIColor clearColor];
tab1Label.textColor = [UIColor blackColor];
tab1Label.opaque = NO;
tab1Label.font = [UIFont systemFontOfSize:14];
tab1Label.numberOfLines = 2;
tab1Label.adjustsFontSizeToFitWidth=YES;
tab1Label.transform = CGAffineTransformMakeRotation (90*3.1459565) / 180);
tab1Label.frame = CGRectMake(2,87,45,119);
[viewForLabels: addSubview: tab1Label];

…

  • 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-15T19:52:56+00:00Added an answer on May 15, 2026 at 7:52 pm

    First in your code example you alloc tabLabel1 and then run a bunch of property updates against a different named object tab1Label.

    Sorry if I am misunderstanding the question but why are you creating a second label? Per this part of your description:

    What’s happening – A user hits a
    button that makes the text they
    selected to appear in the UILabel.
    Then when they select the button
    again, with different text, the new
    text appears in place of the old text.

    Just update the .text property and any sizing needed why use a whole separate object?

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

Sidebar

Ask A Question

Stats

  • Questions 457k
  • Answers 457k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try DBSourceTools. http://dbsourcetools.codeplex.com Its open source, and specifically designed to… May 15, 2026 at 10:43 pm
  • Editorial Team
    Editorial Team added an answer In my experience a team should have (at least) one… May 15, 2026 at 10:43 pm
  • Editorial Team
    Editorial Team added an answer The solution is to draw a rounded bezier path underneath… May 15, 2026 at 10:43 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.