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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:10:55+00:00 2026-05-26T07:10:55+00:00

I am doing an application where i am creating a UILabels programmitically,As i will

  • 0

I am doing an application where i am creating a UILabels programmitically,As i will be creating some 15 labels with different frames so i using only one method and calling it by parameter passing.

when i rotate it to Landscape view the position of the labels should be changed as there will lot of space left empty at right side..so i am trying to use Autoresizing mask but its not working,so please suggest what i should do so that label frame changes and fits at right position when i turn to landscape orientation. please provide me a sample code.The present code i am using is given below.

{
[self.view addSubview:[self createLabel:CGRectMake(450,140,60,20):@"Ratings:"]];  
[self.view addSubview:[self createLabel:CGRectMake(450,170,60,20):@"Reviews:"]];  
[self.view addSubview:[self createLabel:CGRectMake(50,170,50,20):@"Hours:"]];  
[self.view addSubview:[self createLabel:CGRectMake(50,200,50,20):@"Phone:"]];  

self.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
[super viewDidLoad];
}

-(UILabel*)createLabel:(CGRect)frame :(NSString*)labelTitle
{   
UILabel  *myLabel = [[UILabel alloc] initWithFrame:frame]; 

[UIFont fontWithName:@"Arial" size:13];  
myLabel.textAlignment = UITextAlignmentLeft;   
myLabel.font = [UIFont boldSystemFontOfSize:13];
myLabel.text = labelTitle;     
[myLabel autorelease];
return myLabel;
}
  • 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-26T07:10:56+00:00Added an answer on May 26, 2026 at 7:10 am

    You should set also autoresizingMask to all subview of self.view – add, for example, next line in the -(UILabel*)createLabel:(CGRect)frame :(NSString*)labelTitle method:

    myLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
    

    or

    myLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing an application where I am creating a LABELS programmatically..What my Requirement
I'm creating a fast application with ruby on rails, and after doing a lot
I am creating a simple application with Django. I realized that I am doing
I'm writing a Carbon application and we are creating JPEG files. I'm currently doing
People always advised me that if I am doing some application that should use
I am doing a C# application targeting WinXP, Vista, and 7 Operating Systems. One
i am doing one small application , wheich have login functionality, in the user
I'm creating an android application I wish to release commercially. Before doing so I
I'm creating an installer for my application using WIX. Everything works fine so far.
I'm creating a web application that will involve habitual file uploading and retrieval (PDFs,

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.