Post

Replies

Boosts

Views

Activity

Reply to Why does a dismissed child UIView doesn't reappear properly after its first appearance?
Experimenting around I found that if I didn't set the child's constraints (see below), then it would always work. Is there a method to remove the constraints of a UIView before deleting it? vc is the Child UIView and pc is its parent func setConstraints (vc: UIViewController, pc: UIView) { vc.view.translatesAutoresizingMaskIntoConstraints = false var constraints = [NSLayoutConstraint]() constraints.append(vc.view.leadingAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.leadingAnchor)) constraints.append(vc.view.trailingAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.trailingAnchor)) constraints.append(vc.view.bottomAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.bottomAnchor)) constraints.append(vc.view.topAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.topAnchor)) NSLayoutConstraint.activate(constraints) }
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’21
Reply to Why does a dismissed child UIView doesn't reappear properly after its first appearance?
Experimenting around I found that if I didn't set the child's constraints (see below), then it would always work. Is there a method to remove the constraints of a UIView before deleting it? vc is the Child UIView and pc is its parent func setConstraints (vc: UIViewController, pc: UIView) { vc.view.translatesAutoresizingMaskIntoConstraints = false var constraints = [NSLayoutConstraint]() constraints.append(vc.view.leadingAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.leadingAnchor)) constraints.append(vc.view.trailingAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.trailingAnchor)) constraints.append(vc.view.bottomAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.bottomAnchor)) constraints.append(vc.view.topAnchor.constraint(equalTo: pc.safeAreaLayoutGuide.topAnchor)) NSLayoutConstraint.activate(constraints) }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21