PaoloCuscela / Cards

Awesome iOS 11 appstore cards in swift 5.
MIT License
4.2k stars 274 forks source link

CardPlayer Card not loading #94

Closed wirnico closed 5 years ago

wirnico commented 5 years ago

Thanks for your efforts to share with us these amazing Pods. I encountered none problem with the CardPlayer Card. It is not loaded when view is loaded. Even in your demo project there is this issue. If one clicks in the white area where the card should be it pops up and is then visible. Seems that the card infos are not being loaded.

Has someone a solution for me?

tonycrencren commented 5 years ago

Hello friend. I encountered the same issue. Did you ever get it to work?

tonycrencren commented 5 years ago

Hey. Thanks for posting this issue. It was a great reference for the stackoverflow question I just asked. All you have to do is add

backgroundIV.frame.size.height = 300

To line 208 of CardPlayer.swift

https://stackoverflow.com/questions/54920415/cardplayer-card-not-loading/54922400?noredirect=1#comment96612189_54922400

shadowsheep1 commented 5 years ago

Hi guys, as @tonycrencren pointed out, this is solved by adding an height to the frame of CardPlayer background during controller loading. But I would suggest a more general way to do that like the one propose in the above SO answer:

// Issue is here
let currentHeight = backgroundIV.frame.size.height // <-- new line to store current value
/* this is line #207 */ backgroundIV.frame.size.height = originalFrame.height + ( isPresenting ? move/2 : 0 ) // This is line 207

// This is the check
if backgroundIV.frame.size.height <= 0 {
    print ("heigh is 0")
    backgroundIV.frame.size.height = currentHeight
}

First version of my answer maybe was not so clear so we ended up to try a more straight way by setting a fixed height like that

backgroundIV.frame.size.height = 300

Btw, @tonycrencren you did right posting a question on SO.

tonycrencren commented 5 years ago

nice. thanks again

PaoloCuscela commented 5 years ago

Thanks guys. Fixed in 1.4.0 ❤️