Post

Replies

Boosts

Views

Activity

Position image inside UIButton
Hi, I have added a square image inside a UIButton. The goal is to have the square image on the left of the button, with space margin around 4 sides of button = 5. Here is the code: button.imageView?.contentMode = .scaleAspectFit button.contentHorizontalAlignment = .left; button.imageEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5) and here is the result: You can notice several problems: Right margin is > 5 (between button and text) Left margin > 5 The rest, aspect, and top and bottom margins are fine. How to have this button well on the left, and the text right next to it?
0
0
3.0k
Jun ’21
Drag drop nested list in swiftui
Hi, I managed to have a nested list in swiftui 3 (with foreach) and drag and drop to reorder the list when I enter the built-in edit mode. Problems / limitation when dragging / dropping a list item from edit mode: I can't change its nesting level: for example, if I drag an item that is 3 nested levels deep, I can't seem to be able to drop it on let's say level 1. When an item has children, and they are expanded, if I drag the father, the children will not follow. I can't drag from one section, and drop on another. What are the solutions to circumvent those problems? Is there built-in way to do it, if not, is it even possible without resorting to UIKit?
1
0
1.7k
Nov ’22