134 questions
1
vote
0
answers
72
views
How can I get the listRowInsets to create seamless edges in keeping with the rest of a form?
I am trying to make create a view which incorporates a button and a picker in a HStack to eventually be placed inside a form.
I would like the button to seamlessly blend with the edges of the list row ...
1
vote
1
answer
537
views
How to add edge insets to UICollectionView's contentView when using UICollectionViewCompositionalLayout of type .list
I have the following problem:
I want to add horizontal insets to a collectionView's contentView, but when I set the contentInset to UIEdgeInsets(top: .zero, left: 64, bottom: .zero, right: 64) for ...
0
votes
1
answer
559
views
SwiftUI Path.inset(in:) function
I'm trying to inset a path by a constant amount, but for some reason, it appears this is not working. What am I doing wrong?
This works fine; it draws a rectangle of 250x250 with a red border.
let ...
3
votes
1
answer
763
views
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 ...
0
votes
1
answer
240
views
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 {
...
1
vote
0
answers
2k
views
UITableViewController's tableView's Content insets
I want to make a padding for tableView's content. The result should be the following:
Result I want to achieve
If I use tableView.contentInset = UIEdgeInset(...) like this:
func setStandartDesign() {
...
1
vote
0
answers
824
views
How to deal with temporarily incorrect SafeAreaInsets?
I'm working on a nice screen rotation animation in my iOS app.
When the screen's size changes, I update the (Metal) model inside it accordingly.
The problem is that I have visual content "jumps&...
2
votes
1
answer
157
views
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 ...
0
votes
1
answer
3k
views
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 ...
0
votes
1
answer
301
views
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....
0
votes
1
answer
56
views
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, ...
7
votes
2
answers
792
views
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 ...
1
vote
2
answers
1k
views
iOS System Icons not respecting UIButton's UIImageInsets
I am using iOS's system icons so that I can have a consistent user interface throughout my project. One thing that I've noticed when using these icons is that, even if I set a system icon as the image ...
0
votes
1
answer
841
views
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 ...
10
votes
2
answers
10k
views
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 ...
1
vote
2
answers
111
views
Different title origin of UIButton with image inside in different iOS versions
I created a button in interface builder.
Set fixed width = 120 and height = 40 constraints to this button.
After I add an image to button and set image insets (top: 10, left: 0, bottom: 10, right: 100)...
0
votes
1
answer
1k
views
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(_ ...
0
votes
1
answer
357
views
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 ...
0
votes
0
answers
80
views
How do I put some space between the left side of a label and the beginning of the text? [duplicate]
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,...
1
vote
0
answers
697
views
How do I extend the scrollview top under a navigation bar in iOS 12?
I have a UIScrollView under a navigationbar in a detail viewcontroller.
The viewcontroller settings are the following:
The scrollview is pinned to the Safe Area (trailing, leading, bottom, top = 0).
...
0
votes
1
answer
863
views
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 ...
2
votes
1
answer
3k
views
Support NSDirectionalEdgeInsets for UIButton's contentEdgeInsets?
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 ...
3
votes
2
answers
5k
views
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 ...
2
votes
1
answer
771
views
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 ...
0
votes
1
answer
113
views
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 ...
0
votes
1
answer
839
views
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 ...
0
votes
1
answer
198
views
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 ...
0
votes
0
answers
970
views
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 ...
11
votes
4
answers
12k
views
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 ...
2
votes
1
answer
246
views
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 ...
0
votes
2
answers
1k
views
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 ...
11
votes
4
answers
3k
views
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 ...
0
votes
1
answer
805
views
UICollectionView with Insets Not Scrolling All the Way Down
I have a collectionview with content edge insets 8 pixels from both the top and bottom.
When I invoke scrollToItemAt of the collection to the very last item, it scrolls down but is 8 pixels short of ...
0
votes
1
answer
462
views
Why does iPhone X ignore UIEdgeInsets for UICollectionView?
I have code for my collectionView that adjusts the content so that it sits beneath the navigation bar.
collectionView.contentInsetAdjustmentBehavior = .never
let tabBarHeight = self....
1
vote
0
answers
572
views
UITableView viewForHeaderInSection Issue with UITableView content Inset
I'm working with a UITableView.
The table view has a HeaderView with a UIImageView that changes its height when the user scroll the table view.
In addition to this I also have a custom uiview for the ...
-3
votes
1
answer
2k
views
convert Swift 2.3 to Swift 4 [duplicate]
I am new in Swift 4 and I want to resolve the Swift version 2.0 Project with Uitextview error
here is error in Swift 4
let textView = UITextView(frame: CGRectInset(view.bounds, 10, 10))
I will ...
0
votes
2
answers
5k
views
programmatically adjust collectionView for safeArea
I'm trying to set up a horizontally scrolling collection view that has cells with size CGSize(width: view.frame.width, height: view.frame.height). However, my cells are partially covered at the top by ...
0
votes
0
answers
373
views
Tab bar item scales if click twice or more
I want to set the images of tab bar items a bigger size. So I put this code in my TabBarViewController.viewDidLoad():
let titleTabrItems = ["Favourites","Calc","Time","Live","Shop"]
for (...
1
vote
0
answers
2k
views
UIScrollView automatic content inset behavior working in iOS 11 but not iOS 10?
I'm new to the game so I've really only worked with iOS 11 and have recently acquired heartburn trying to figure out what Apple had in mind with their now-deprecated inset behaviors in iOS 10. And ...
7
votes
1
answer
16k
views
How can I achieve having an UITableView set the insets of its cells without setting the inset on the entire table?
I have a UITableViewCell with content that extends to all of its edges. I use this cell in multiple tables with where it needs varying insets. (i.e. one table will have it inset from the left by 8 ...
2
votes
1
answer
269
views
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 ...
0
votes
1
answer
91
views
Text padding on UILabel not working
This post is to complete one I made a while ago titled Text padding on UILabel, left with no answer.
The screenshot below shows it all. The first label, though the shortest is truncated. The second ...
1
vote
0
answers
2k
views
Objective-C: Detect iPhone X with Safe Area Insets
I'm trying to detect if the current device is an iPhone X in Objective-C. I've looked at some other posts that do this in Swift and a proper method seems to be to compare the safe area insets with ...
2
votes
1
answer
959
views
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 ...
1
vote
1
answer
265
views
UIButton tap area got smaller on iOS 11
I notice the tap area for my UIButton got smaller since iOS 11. To confirm, I commented out the desired background color on its subviews and put purple color on the button itself.
iOS 10.0.3 (Button ...
2
votes
2
answers
9k
views
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 ...
0
votes
1
answer
87
views
UITabBarController icons changing height on touch
I have an issue with UITabBarController, the icons are changing size if I keep my finger on them and drag up or down, they are losing height by my dragging action, how can I stop that?
Here is my ...
1
vote
1
answer
153
views
BarButtonItem EdgeInsets doesn't work
I'm trying to add a padding to the right of a navigationBar rightBarButtonItems in between the buttons but it's now working.
Here's the button creation code with the given inset:
lazy var ...
0
votes
1
answer
673
views
how to set the values for UIEdgeinset for button
I wanted to increase the button touch area without without actually increasing its original size.
When it comes to insets there are so many in Button and there is no clear documentation I could find ...
0
votes
1
answer
538
views
Custom UISlider using UIEdgedInset does not render well
I'm trying to do a custom uislider using images (without a visible knob, i hide it when user can't edit and show it when he can) The problem is that the the side render perfectly but the right part is ...