Skip to content

How to set @QuickLayout view frame in UIViewController #7

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)
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions