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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:03:05+00:00 2026-06-12T09:03:05+00:00

I am putting a UILabel in a custom UIImageView and the text is being

  • 0

I am putting a UILabel in a custom UIImageView and the text is being cut off:

screenshot

Code:

//self.frame.size.width and height are the same value, self is a square
self.displayNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, (self.frame.size.width - 12), (self.frame.size.height - 12))];
self.displayNameLabel.center = CGPointMake((self.frame.size.width / 2), (self.frame.size.height / 2));
self.displayNameLabel.backgroundColor = [UIColor whiteColor];
self.displayNameLabel.textAlignment = UITextAlignmentCenter;
self.displayNameLabel.font = [UIFont fontWithName:labelFont size:40];
self.displayNameLabel.adjustsFontSizeToFitWidth = YES;

I set the font size large and then use adjustsFontSizeToFitWidth to make sure it’s as large as it can be. It states:

If this property is set to YES, however, and the text in the text property exceeds the label’s bounding rectangle, the receiver starts reducing the font size until the string fits

If I set the label.frame to:

self.displayNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, (self.frame.size.width - 0), (self.frame.size.height - 0))];

Then it works as intended.

How does setting the frame to:

self.frame.size.width
self.frame.size.height 

instead of:

self.frame.size.width - 14 
self.frame.size.height - 14

work?

Why is it getting clipped on the top?

  • 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-06-12T09:03:06+00:00Added an answer on June 12, 2026 at 9:03 am

    The property adjustsFontSizeToFitWidth will only cause the label to adjust the font size until the width of the string fits within the frame. If the label is not tall enough to accommodate the final font size it will be clipped.

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

Sidebar

Related Questions

I have a custom UIView with nested views of type UIImageView, UILabel and UIButton.
I am putting a label on a UIToolbar (per this tip: Adding a UILabel
Putting code at aspx files is slower? The code is recompiled every access? At
I putting wmd on my website. After putting code in and giving it a
Just putting part of some code here where I am writing two values to
I have putting such data into LinearView. as like below code: public void showResult()
When putting a <img> in text, it seems to want the bottom of the
I putting an in-game chat module into an app. I am adding text messages
Any idea why putting google plus code this way wont work in IE8 or
I am creating a custom cell class wherein I am putting different types of

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.