Skip to content

How to set @QuickLayout view frame in UIViewController #7

@zeroskylian

Description

@zeroskylian

How to automatically set MyCellView frame

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
       // how to set MyCellView frame
        view.addSubview(MyCellView())
    }
}
@QuickLayout
class MyCellView: UIView {
    
    let titleLabel = UILabel(text: "titleLabel")
    let subtitleLabel = UILabel(text: "subtitleLabel")
    
    let imageView = UIImageView()
    
    var body: Layout {
        HStack {
            VStack(alignment: .leading) {
                titleLabel
                Spacer(4)
                subtitleLabel
                imageView.resizable()
            }
            Spacer()
        }
        .padding(.horizontal, 16)
        .padding(.vertical, 8)
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions