Home > Enterprise >  UITableViewCell custom cell
UITableViewCell custom cell

Time:01-16

1.i want to margin like (from left =10, right=10 etc) between two views in Stack View 2.Reduce space between two view in vertical stackview

(https://i.stack.imgur.com/3JElC.jpg)

CodePudding user response:

To add margins between two views in a Stack View, you can use the layoutMargins property of the Stack View. This property allows you to set the top, bottom, leading, and trailing margins of the views within the Stack View. For example, to set a margin of 10 points on the left and right sides of the views, you can use the following code:

stackView.layoutMargins = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)

To reduce the space between two views in a vertical Stack View, you can use the spacing property of the Stack View. This property controls the distance between the views. For example, to set the spacing to 5 points, you can use the following code:

stackView.spacing = 5

CodePudding user response:

1- you can add the margin left and right to your UITextView or UILabel.

2- change the spacing of the vertical UIStackView.

  • Related