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
0
votes
1 answer

Left Aligning a subview to UINavigationBar Large Title

I have a UIViewController as the root of a UINavigationController and I have set the preference for large titles as follows navigationController?.navigationBar.prefersLargeTitles = true My goal is to align the left of my view to the left of the…
Shawn Frank
  • 4,381
  • 2
  • 19
  • 29
0
votes
1 answer

Swift UIButton .contentVerticalAlignment property doesn't work good

I need to attach title of UIButton to the top-right corner, but when I use .contentVerticalAlignment property, there is a space between the top and the title. class ViewController: UIViewController { let button: UIButton = { let button =…
ergl1s
  • 1
  • 1
0
votes
1 answer

How do you use UIEdgeInsets?

I've been trying different ways on the Playground, but the margins are not being implemented. I'm trying to understand the proper way of using UIEdgeInsets (and NSDirectionalEdgeInsets). The expectation is that the super view should have margins of…
Kevvv
  • 3,655
  • 10
  • 44
  • 90
0
votes
1 answer

iOS 14 and Simulator UILabel extension padding bug

I use this UILabel extension for label padding in a lot of areas in my projects. And it works perfectly on iOS 13 and older version devices. But it doesn't work at all on iOS 14 devices and Simulators. How can I solve this problem at least on iOS…
Hilalkah
  • 945
  • 15
  • 37
0
votes
1 answer

How to remove NavigationBar Right space?

I'm playing with Navigation Bar Buttons I need a button from right edge with 0 space, after google search i found below code self.filterButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 80, 45)]; [self.filterButton…
Bittoo
  • 579
  • 7
  • 21
0
votes
1 answer

swift UIPrintPageRenderer printableRect.size.width is always zero (0)

I'm using a UIActivityViewController to print (amongst other activities). So I pass it an instance of my custom subclass of UIPrintPageRenderer, for which the relevant code is below. In essence, I want to print two multi-line attributed strings,…
Son of a Beach
  • 1,733
  • 1
  • 11
  • 29
0
votes
1 answer

UICollectionView - add bottom inset for entire collectionView

I have a UICollectionView with multiple sections. I would like to add bottom inset to the entire collectionView. All the Q&As suggest to use the following function: func collectionView(_ collectionView: UICollectionView, layout…
Luda
  • 7,282
  • 12
  • 79
  • 139
0
votes
1 answer

How to get rid of the padding between UIButton image and the borders of the UIButton?

I would like to get rid of the spacing between the top of the UIButton image and the top border of the UIButton as well as the bottom of the UIButton image and the bottom border of the UIButton (refer to attached image). I tried to use the below…
0
votes
0 answers

How do I put some space between the left side of a label and the beginning of the text?

How do I put some space between the left side of a label and the beginning of the text? I try to adjust the edge insets, but it is get only. The code: label.alignmentRectInsets = UIEdgeInsets(top: 2, left: 2, bottom: 2, right: 2) Gets an error…
daniel
  • 1,446
  • 3
  • 29
  • 65
0
votes
1 answer

Setting content insets on UITextView using XIB

I have a UITableViewCell which contains a UITextView. I'd like to set padding on this text view, so that the cell content is pushed in by 10 on each side. I understand I can do this in code using textView.textContainerInset =…
Harry Blue
  • 4,202
  • 10
  • 39
  • 78
0
votes
1 answer

UIStackViews Autolayout throws when either spacing or contentEdgeInsets of UIButton is enabled

I got a UIStackView ParticipateButtonStackView managing three buttons of the same class: ParticipateButton These buttons only contain an image. To have some padding at the top and bottom, I set UIEdgeInsets. But this and the .spacing = 1 property…
Noodledew
  • 509
  • 4
  • 19
0
votes
1 answer

How to Hide Content on Status Bar When Scrolling on iPhone X

I have a UICollectionView that scrolls vertically. The collection view is a form. It has multiple sections, each section has a few items in it. The top section has a header which is pinned to the top of the view so it remains in place as the content…
tentmaking
  • 2,076
  • 4
  • 30
  • 53
0
votes
1 answer

Why is this UIButton not rounding Swift?

I have this UINavigationBarButton I am making with an image inside of it that is originally square. I have used this code on other regular buttons and it has made the images round. However, it is not working for this button and I have no idea why.…
Levi K
  • 573
  • 1
  • 4
  • 23
0
votes
0 answers

How do I set image and text edge inset by using storyboard for Button states

I want to the image image normal state. and for button selected state, In the selected state I need a line at the bottom of the button. I am setting a image as the button title and I can adjust the positions by using the below section. But, my…
Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
0
votes
2 answers

Why does my UICollectionView scroll up when clicking on a cell?

My UICollectionView always scrolls a bit up when clicking on a UICollectionViewCell. I noticed that this behavior does not occur if I set the collection view inset to 0 (no inset at all) and the contentInsetAdjustmentBehavior to .never. However, I…
j3141592653589793238
  • 1,810
  • 2
  • 16
  • 38
1 2 3
8 9