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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:00:10+00:00 2026-05-24T22:00:10+00:00

Ok, here’s my problem. I have a rather large set of UIButtons that have

  • 0

Ok, here’s my problem. I have a rather large set of UIButtons that have a UIImage set as a background. Now I want to add labels inside those buttons. But the design I’m currently implementing uses “fancy” labels where the background color of the label is semi transparent and collapses around the text.

My first idea was to use a UIWebview to make that happen and it works, but adding a lot of UIWebview’s takes a really long time for the labels to show up.

Next solution would be to use an UILabel and the performance is times better. But for the life of me, I cannot figure out, how to get the visual style to match the design.

So basically I’m looking to make an UILabel behave like an HTML element that has as CSS rule display: inline; style defined.

Is this even possible with the built-in parameters of an UILabel? If not, I’m probably going to use the UIWebView solution, but it would be of course much niftier to use the UILabel’s.

Here’s a screenshot that should explain it somewhat better

Top is how the default UILabel acts and bottom is how I want it to act.

  • 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-24T22:00:13+00:00Added an answer on May 24, 2026 at 10:00 pm

    I’ve managed to find a solution that almost works as intended. It doesn’t collapsed around all the single lines, but it collapses the box around the text and that,s good enough for me at the moment.

    Here’s the final code that does the trick for me:

    UILabel *buttonTitle = [[UILabel alloc] initWithFrame:CGRectMake(4, 4, 176, 120)];
    buttonTitle.text = @"Button text";
    buttonTitle.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.65];
    buttonTitle.textColor = [UIColor whiteColor];
    buttonTitle.textAlignment = UITextAlignmentLeft;
    buttonTitle.numberOfLines = 0;
    buttonTitle.lineBreakMode = UILineBreakModeWordWrap;
    buttonTitle.adjustsFontSizeToFitWidth = NO;
    [buttonTitle sizeToFit];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So here is my problem: I have an image, that image is large (high
Here is the problem: I have two columns in a table that, for each
Here's my problem: I have an unmanaged dll that I made.I'm calling one of
I have built an application in flash, it is rather a large application that
I have a rather large chunk of code that breaks sometimes, as far as
We have a rather large application my team and I are developing that contains
I have problem adding arraylist to list view, will explain about my problem here..
First, sorry for my bad english, I'm French. Here the problem : I have
Here's the problem: I have a data-bound list of items, basically a way for
Here is my problem : I have a list of messages which I can

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.