MillmanY / MMCardView

Cusom CollectionView card layout
MIT License
561 stars 47 forks source link

Issue with Card View Not Showing #4

Open winniepooh001 opened 7 years ago

winniepooh001 commented 7 years ago

Hi,

Thank you for sharing the card view it looks very good. I'm having trouble to get the example working (I'm using Materials as well) card view is not showing. I did try to isolate and see if it is related to the cell, but if i just show the cell they will show in view. I'm doing it without storyboard. I'm not sure if i would be the cause of the problem. Only the first few lines of the code from example I changed just so that I can figure out why its not showing. However, I still couldn't figure out. It looks like objects were initiated under the card view, but the card view is not showing.

var card = CardView(frame: CGRect(x: 100, y: 200, width: 500, height: 500))

open override func viewDidLoad() {

    super.viewDidLoad()

    self.card.frame  = CGRect(x: 100, y: 200, width: 500, height: 500)
    self.card.backgroundColor = UIColor.red

    view.addSubview(self.card)
     self.card.cardDataSource = self
    self.card.registerCardCell(c: CardACell.classForCoder(), nib: UINib.init(nibName: "CardACell", bundle: Bundle.main))

    prepareToolbar()
    let arr = self.generateCardInfo(cardCount: 10)
    self.card.set(cards: arr)

    self.card.showStyle(style: .cover)
    //view.layout(card).horizontally().center()

    view.backgroundColor = UIColor.purple

}