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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:52:24+00:00 2026-05-30T16:52:24+00:00

NSString *message = @Can be a short string or a very long string; CGSize

  • 0
NSString *message = @"Can be a short string or a very long string";

CGSize rowSize = [message sizeWithFont:[UIFont fontWithName:@"Helvetica" size:16.0] constrainedToSize:CGSizeMake(250, 1000) lineBreakMode:UILineBreakModeWordWrap];

CGSize rowSizeBold = [message sizeWithFont:[UIFont fontWithName:@"Helvetica-Bold" size:16.0] constrainedToSize:CGSizeMake(250, 1000) lineBreakMode:UILineBreakModeWordWrap];

(rowSize.height and rowSizeBold.height are always equal) – this wasn’t right – thx to jaydee3

the returned height is wrong and clips the text.

Any ideas?

solution: (works for Helvetica, Helvetica-Bold and any other font)

Reducing the width of the rowSize by the margin (15) returns the right height for UITextField.

NSString *message = @"Can be a short string or a very long string";

CGSize rowSize = [message sizeWithFont:[UIFont fontWithName:@"Helvetica-Bold" size:16.0] constrainedToSize:CGSizeMake(235, 1000) lineBreakMode:UILineBreakModeWordWrap];

UITextField *messageTextView.frame = CGRectMake(60, 10, 250, rowSize.height);

thx to Ganzolo!

  • 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-30T16:52:25+00:00Added an answer on May 30, 2026 at 4:52 pm

    If you are using UITextField to display font, you’d probably get this wrong result because UITextField has margin.

    So in your constrained size you should remove the margin of the UITextField on the width component.

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

Sidebar

Related Questions

Can I make a break point at the specific NSString object's release message? for
NSString *phoneNumber = @2310234432; I would like to create a new string out of
Usign the NSString class method stringWithContentsOfFile:encoding:error I can: NSError *error; NSString *fileContent = [NSString
<script language=javascript> alert(Hell! UIWebView!); </script> I can see the alert message inside my UIWebView
How can I send an SMS message programatically from an iPhone app? I'm using
Short question: What does an exception's sourceID refer to, and how can I link
How can I expand a macro inside NSString? I've got the following code: #define
I'm trying to develop a simple application where i can encrypt a message. The
NSString *latitude = [[NSString alloc] initWithFormat:@%g°, coordinate.latitude]; NSString *longitude = [[NSString alloc] initWithFormat:@%g°, coordinate.longitude];
NSString *msg = [[NSString alloc]initWithFormat:@Hello %s, What do you do, (self.isUser ? @User :

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.