Friday, July 3, 2026
HomeiOS Developmentios - Complete content material out of view

ios – Complete content material out of view

[ad_1]

I’ve a Shuffle bundle added to my challenge (https://cocoapods.org/pods/Shuffle-iOS), the bundle works nice, however the issue is that regardless that I set cards width and top to my UIView, playing cards are out of UIView anyhow, I attempted altering the body of my playing cards and set width and top to UIViews, however they’re nonetheless out of UIView any options?

my UIView is mainView in code under

func card1(index: swipeCardData) -> SwipeCard {
    let card = SwipeCard()
    card.swipeDirections = [.left, .right, .up]
    card.layer.cornerRadius = 12
    card.layer.shadowOffset = CGSize.zero
    card.layer.shadowOpacity = 1.0
    card.layer.shadowRadius = 6.0
    card.layer.masksToBounds =  false
    card.layer.borderWidth = 2
    
    let view_bg = UIView(body: CGRect(x: 16, y: 60, width: mainView.body.dimension.width, top: mainView.body.top)) // right here is ready playing cards width and body to my UIView
    card.content material = view_bg
    view_bg.layer.cornerRadius = 12
    view_bg.clipsToBounds = true
    
    DispatchQueue.most important.asyncAfter(deadline: .now() + 0.1) { [self] in
        
        let view_bg1 = UIView(body: CGRect(x: 0, y: 0, width: view_bg.body.dimension.width, top: view_bg.body.dimension.top))
        
        card.content material?.addSubview(view_bg1)
        
        let img_card_type = UIImageView(body: CGRect.zero)
        img_card_type.contentMode = .scaleAspectFit
        img_card_type.translatesAutoresizingMaskIntoConstraints = false
        img_card_type.isHidden = true
        view_bg1.addSubview(img_card_type)
        img_card_type.centerXAnchor.constraint(equalToSystemSpacingAfter: view_bg1.centerXAnchor, multiplier: 1).isActive = true
        img_card_type.topAnchor.constraint(equalTo: view_bg1.topAnchor, fixed: 0).isActive = true
        img_card_type.widthAnchor.constraint(equalToConstant: 100).isActive = true

footage for higher understanding :

enter image description here

as you possibly can see on the screenshot above the cardboard content material is out of mainView which is within the background(grey field)

the top consequence under

enter image description here

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments