Questions tagged [uiedgeinsets]

UIEdgeInsets is an iOS data type that defines inset distances for views.

UIEdgeInsets defines inset distances for views. Edge inset values are applied to a rectangle to shrink or expand the area represented by that rectangle. Typically, edge insets are used during view layout to modify the view’s frame. Positive values cause the frame to be inset (or shrunk) by the specified amount. Negative values cause the frame to be outset (or expanded) by the specified amount.

It is available in iOS 2.0 and later.

Source: UIEdgeInsets

Related SO questions:

  1. How does UIEdgeInsetsMake work?

  2. UIEdgeInsetsMake creating a weird band on the cell, and I don't know how to fix it

  3. Shrink UIButton's frame after setting UIEdgeInsets

Related tags:

132 questions
3
votes
2 answers

UITabbar Images and title are not center aligned in ipad

I am working on application which uses Tabbarcontroller (There are two tabs ) Everything works fine on iphone but on ipad both the tabs comes in center of the screen I want to show the title and images in center of each tab (considering the tab…
Poonam
  • 216
  • 3
  • 14
3
votes
1 answer

TabBar Image Insets Not Transferring To AdHoc Build

So, the below code is centering all of my tab bar images, and it works correctly when built by hitting run, but when I load an AdHoc build, only the last image is centered correctly. [[[self tabBar].items objectAtIndex:0]…
2
votes
1 answer

How can I center Buttons within UICollectionViewFlowLayout for two columns? Might there be a more efficient way to solve this?

I am implementing a menu, which holds severals buttons within two columns and I want the button text to be centered in the middle for every cell. This is what it looks like right now: This is my code for ViewController: import SideMenu import…
2
votes
1 answer

Support NSDirectionalEdgeInsets for UIButton's contenEdgeInsets?

I would like to use NSDirectionalEdgeInsets to UIButton's contentEdgeInsets and titleEdgeInsets. Is that possible? Background For localization purposes, an iOS application may be required to adapt to both Left-To-Right and Right-To-Left languages…
om-ha
  • 3,102
  • 24
  • 37
2
votes
2 answers

How do I create padding around the text of a UILabel?

I'm styling a UILabel programmatically and having trouble getting any padding around the label's text: After studying many SO threads on the subject (this one, in particular) I thought I'd found a solution but it has no affect on the label. I've…
Jim
  • 1,260
  • 15
  • 37
2
votes
1 answer

How to keep the text of a UILabel inside the safeArea?

I've created a custom UILabel in order to be able to change its safe area so the text could have some padding and look nicer, but after I changed my safeArea the text still go all the way from edge to edge and no padding added here's my code class…
Lucas
  • 746
  • 8
  • 23
2
votes
1 answer

SafeArea backwards compatibility

I'm having an issue when trying to layout a view programatically and I cant seem to find a concise, non hacky way to fix it. I'm using safeAreaInsets to size some elements in my view. This works well until I try it out on a pre iOS 11 device.…
Craigt
  • 3,418
  • 6
  • 40
  • 56
2
votes
1 answer

Swift: UIButton edgeinsets applies after cell redrawn/scroll

After couple of days struggling I wanted to ask you about UIButton title and image edge insets... I have custom cell with button and on that button depends on cell type should be different icons and text but the requirement text should be centered…
mihatel
  • 846
  • 14
  • 34
2
votes
1 answer

Text padding on UILabel

Here, I am trying to have a label with some padding (left, right, top and bottom) around the text. This issue has related post on SOF and after reading a few of them, I tried using a solution proposed here: This is the code for my subclassing…
Michel
  • 10,303
  • 17
  • 82
  • 179
2
votes
2 answers

How to adjust left and right insets or margins for UITableView tableHeaderView?

I have a "plain" style UITableView. I am setting a view as the tableViewHeader for the table view. The table also shows the section index down the right side. My issue is figuring out how to inset the left and right edge of the header view to take…
rmaddy
  • 314,917
  • 42
  • 532
  • 579
2
votes
0 answers

UIButton's image and title edge insets programmatically in Swift

I am setting two UIButtons programmatically which look like this: I am trying to set the image and text insets to be the same in buttons, but somehow left button's image is located differently than the right one. I have this extension to UIButton…
Bastek
  • 899
  • 1
  • 12
  • 27
2
votes
0 answers

iOS - UIButton image insets issue

I set up an image for a UIButton in interface builder and I'm having an issue. I set the edge insets of the image (top: ~15, bottom: ~15) to make it fit better within the button. Unfortunately, since the button itself has an aspect ratio…
Ryan Bobrowski
  • 2,641
  • 3
  • 31
  • 52
2
votes
1 answer

Add padding into UIlabel text?

I've a label in a table cell and I wish to add padding to top,bottom,left and right. CGRect initialFrame = CGRectMake(10,10,100,20); UIEdgeInsets contentInsets = UIEdgeInsetsMake(5, 0, 5, 0); CGRect padd = UIEdgeInsetsInsetRect(initialFrame,…
Vincia Tanqling
  • 57
  • 1
  • 11
2
votes
1 answer

Storing UIEdgeInsets in NSArray

I am trying to create a list of UIEdgeInsets instances in Objective-C. Since they are not id type, I couldn't add them into an array. What I want to do is something like this: NSArray *contentInsets = @[{10, 20, 30, 40}, {10, 10, 10, 10},…
Ozgur Vatansever
  • 49,246
  • 17
  • 84
  • 119
2
votes
1 answer

UITableView separator inset changing to default upon scrolling tableview in iOS7

I have tried to set the separator inset on the right. Upon the first run of the project and before scrolling the tableview, everything appears smooth. But then as soon as the scrolling happens once, the separator inset of the last row in each…
keepsmiling
  • 370
  • 1
  • 13
1 2
3
8 9