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
60
votes
3 answers

How does UIEdgeInsetsMake work?

I'm making an app where I use UIEdgeInsetsMake for resizableImageWithCapInsets, but I don't understand how does it works exactly, UIEdgeInsetsMake has 4 arguments: Top Left Bottom Right But they're floats so I don't know how to set that to an…
pmerino
  • 5,900
  • 11
  • 57
  • 76
45
votes
4 answers

Can I adjust a CGRect with a UIEdgeInsets?

I've got a CGRect, and I'd like to adjust it with a UIEdgeInsets. It seems like perhaps there might be a built in function that does this. I've looked for a CGRectAdjustByInsets or functions with some other CGRect… prefix, but I didn't find…
Benjohn
  • 13,228
  • 9
  • 65
  • 127
39
votes
2 answers

How to set content inset for UITextView in ios

I'm having a UITextView and set content inset as [atextView setContentInset:UIEdgeInsetsMake(0, 10, 0, 0)]; This code working in iOS 6.1 and below, but nothing happens in iOS 7.0.
Muruganandham K
  • 5,271
  • 5
  • 34
  • 62
30
votes
18 answers

Align button image to right edge of UIButton

There are plenty of threads about aligning a button image according to the title text, but I can't find anything about just aligning the image to the right side of the button. This has no effect: button.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0,…
soleil
  • 12,133
  • 33
  • 112
  • 183
26
votes
3 answers

UIScrollView Zooming & contentInset

Simliar to iOS Photos App where the user is zooming in and out of an image by pinching: UIView > UIScrollView > UIImageView > UIImage Initially, I had the issue of zooming below scale 1: image being off centered. I got it fixed by doing this: func…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
24
votes
3 answers

Center UIButton image with inset

I'd like to create a UIButton, but with a larger tap area than the image. (Ex: 40x40 button, but the image is only 20x20, centered). Is that what imageEdgeInsets is for? I've set it both programatically: (This is in the UIView which contains my…
Lord Zsolt
  • 6,492
  • 9
  • 46
  • 76
22
votes
3 answers

How to use UIEdgeInsets property in Button in iphone

I am new to iOS application development and wanted to know how to use UIEdgeInsets property in button so please guide me.
Ankit
  • 253
  • 1
  • 2
  • 3
18
votes
2 answers

How to change default UIButton padding when using auto-layout

When using auto-layout in iOS 6, a UIButton's intrinsic content size appears to include about 10px of padding around the button text. Is there any way to control this padding value? For example, I'd like to be able to do something like this, which…
Greg Brown
  • 3,168
  • 1
  • 27
  • 37
11
votes
4 answers

fatal error encountered while deserializing SIL global "UIEdgeInsetsZero"

Using Swift 4.2 with Xcode 10 beta, if I write: import UIKit let foo: UIEdgeInsets = .zero Then I get a fatal error at compile time: *** DESERIALIZATION FAILURE (please include this section in any bug report) *** result is ambiguous 0 swift …
Cœur
  • 37,241
  • 25
  • 195
  • 267
11
votes
0 answers

Setting content edge insets on a UIButton doesn't work as expected

I have a UIButton that is set up like this: UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; button.backgroundColor = [UIColor redColor]; [self addSubview:button]; [button setTitle:@"myButton" forState:UIControlStateNormal]; The…
Darren
  • 10,091
  • 18
  • 65
  • 108
9
votes
2 answers

Make UITableView ignore Safe Area

I have a TableView inside a ViewController. I made the TableView stretch to the View SuperMargings (with constraints) and disabled all SafeArea Inset options but my TableView is still under the SafeArea when I run my project. How can I make my…
helloimbrando
  • 307
  • 2
  • 13
9
votes
4 answers

Set insets on UILabel

I'm trying to set some insets in a UILabel. It worked perfectly, but now UIEdgeInsetsInsetRect has been replaced with CGRect.inset(by:) and I can't find out how to solve this. When I'm trying to use CGRect.inset(by:) with my insets, then I'm…
Jacob Ahlberg
  • 2,352
  • 6
  • 22
  • 44
9
votes
3 answers

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

I'm trying to use UIEdgeInsetsMake to make set the background of my cell to a gradient. I've tried multiple things to get it to work, but no matter what I use, there's always an issue. I simply have two static cells, where I'm trying to set their…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
8
votes
5 answers

Bounds automatically changes on UIScrollView with content insets

I'm using a UIScrollView as my paging scroll view, pagesScrollView. Inside that, I put individual UIScrollViews which are used exclusively for zooming. Inside each of those, I have one view which is the page item which should be zoomable. All of…
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
7
votes
2 answers

UIEdgeInsets not working on System Images in TabBar

I am using XCode System Images (SF Symbols) for UITabBarItem Images. I'd like to remove the UITabBarItem Title which I have done. But also move the UITabBarItem Image down slightly. In the past when I wasn't using System Images this would work…
David Henry
  • 1,972
  • 20
  • 43
1
2 3
8 9