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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:01:54+00:00 2026-05-16T23:01:54+00:00

I have an NSString like @Hello World and want to convert that into an

  • 0

I have an NSString like @"Hello World" and want to convert that into an bitmap with exactly 20 pixels height. The width of the bitmap should match the width of the text.

I know there are some NSString UIKit additions that can draw text, but I don’t know how to draw the text with an bounding box of exactly 20 pixels height (text fits perfectly into this height) into an bitmap that has the perfect size to carry the text?

Is there an easy way to do this?

This must also work with Chinese, Japanese, Russian and Arabic style letters. Maybe I could just put the text in a UILabel and then get it’s content bitmap somehow. But the content bitmap of the UILabel would be either too short, or too long in width.

Maybe I must first ask the text itself how big it would be at a certain font size (= height?), and then manually create a bitmap with the exact dimensions needed, and draw the text on this bitmap?

  • 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-16T23:01:54+00:00Added an answer on May 16, 2026 at 11:01 pm

    The way I was told to do it for Cocoa at this question works, and despite the premature optimisation part of my brain doing a wobbly it isn’t too slow.

    Once you’ve drawn the text to your satisfaction, you can use this method to obtain an image representation of the view.

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

Sidebar

Related Questions

I have a NSString like this: Hello World of Twitter Lets See this >
Hi I want to convert the NSString into Byte array. if I have string
i have an NSString like Hello - this is me. I want to search
I have something like: NSString *str = hello this is 123.; I want it
hello i am a beginner in objective-c i have a nsstring like this Select
I have NSString like this @0,0,0,0,0,0,1,2012-03-08,2012-03-17 . I want values separated by comma. I
I have a NSString like this NSString *mystring = @RahulVyas; Now I want to
Hi I have a string like that NSString *str=@1,2,3,4; I have to remove any
I'm trying to do something like this .. NSString *string = [NSString stringWithFormat:@Hello World];
I have a NSString like that? (in iPhone application) NSString *xmlStr = <?xml version=1.0

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.