Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

By default, the SDK will set the placement’s height for you.
To override this behavior - set and implement “layoutDelegate“implement AdPlacementLayoutDelegate and set it to `placement.layoutDelegate`

Code Block
languageswift
// ViewController.viewDidLoad
placement.layoutDelegate = self
self.adPlacementHeightConstraint = placement.heightAnchor.constraint(equalToConstant: 0)

extension ViewController: AdPlacementLayoutDelegate {
    func adPlacementHeightWillChange(to newValue: CGFloat) {
       guard newValue != adPlacementHeightConstraint.constant else { return }
       
       adPlacementHeightConstraint.constant = newValue
    }
}


For an advanced UI layout example please refer to the following:
CollectionView Example -> AdPlacementCollectionViewCell
SwiftUI Example