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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:05:38+00:00 2026-06-04T02:05:38+00:00

I am having a trouble adding left padding on a UIButton . I have

  • 0

I am having a trouble adding left padding on a UIButton. I have a UIButton with UIControlContentHorizontalAlignmentLeft. I want the text to be displayed on the left side but it is too left. when I give the border, it doesn’t look good. I would like to give some padding on the text about 5px like in CSS. I googled for the solution but can’t find one particularly for UIButton.

  • 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-04T02:05:39+00:00Added an answer on June 4, 2026 at 2:05 am

    titleEdgeInsets The inset or outset margins for the edges of the
    button title drawing rectangle.

    @property(nonatomic) UIEdgeInsets titleEdgeInsets

    Discussion Use this
    property to resize and reposition the effective drawing rectangle for
    the button title. You can specify a different value for each of the
    four insets (top, left, bottom, right). A positive value shrinks, or
    insets, that edge—moving it closer to the center of the button. A
    negative value expands, or outsets, that edge. Use the
    UIEdgeInsetsMake function to construct a value for this property. The
    default value is UIEdgeInsetsZero.

    Availability Available in iOS 2.0 and later.

    Declared In UIButton.h

    Give this a try 🙂

    [myButton setTitleEdgeInsets:UIEdgeInsetsMake(0.0, 5.0, 0.0, 0.0)];
    

    Also if you’re using a custom button there is such a thing as Content Insets and Image Insets.

    Incase you’ve made it here looking for Swift. This is valid Swift 3.0

    myButton.titleEdgeInsets = UIEdgeInsets(top: 0.0, left: 5.0, bottom: 0.0, right: 0.0)
    

    You can set it directly as well. It is helpful if want to use one or two properties.

    myButton.titleEdgeInsets.top = 0
    myButton.titleEdgeInsets.left = 5
    myButton.titleEdgeInsets.bottom = 0
    myButton.titleEdgeInsets.right = 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery ui tabs with the following code but am having trouble adding
I'm having trouble adding a slashed slug and nested routes. If I have these
I'm having trouble with the cursor in a searchbox that displays too far left
I am having some trouble adding a text from my MySQL database into a
I'm having trouble adding Facebook Connect to my iPhone Project. Here's the directory structure:
I'm having trouble adding icons to jQuery UI's buttonset's.Adding icons to buttons work fine.Does
I'm having trouble adding a static library from another Xcode project ( CloudApp API
I am trying to add a key value pair and having trouble adding the
Using MongoDB, I'm having trouble adding en element to an Array when the array
I am disabling a form based on a checkbox... I am having trouble adding

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.