Git Product home page Git Product logo

mmcardview's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmcardview's Issues

set(cards:) need DispatchQueue.main.async

This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.

How can i have section header?

I have tried to setup a section header using UICollectionReusableView. but, it is not showing up.
Is there any way to achieve a section header with this library?

Issue with Card View Not Showing

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
    
   
}

Reloading items when scrolling.

We are trying to display images from network in cell items. Our images were blinking simultaneously when scrolling MMCollectionView.

NumberOfItemsInSection method is keep calling when scroll the items. Why this is happening?

Pls suggest to solve this issue asap.

Thanks

Filtering is not working properly

I altered some things in your example ViewController.swift to give you the perspective I'm facing, those were the changes:

var titleArray = ["GIOVANNIJ","MARCO","IBITCI","GOD","DID","RUAN","APPEND","BIAJ","LELE","TETE"]

func generateCardInfo (cardCount:Int) -> [AnyObject] {
    var arr = [AnyObject]()
    let xibName = ["CardA"]//,"CardB","CardC"]
    
    for _ in 1...cardCount {
        let value = Int(arc4random_uniform(UInt32(xibName.count)))
        arr.append(xibName[value] as AnyObject)
    }

    return arr
}

func cardView(collectionView:UICollectionView,item:AnyObject,indexPath:IndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: item as! String, for: indexPath )
    switch cell {
        case let c as CardACell:
            c.txtView.text = "Hello This is MMCardView ,Its a demo with different Card Type,This is a text type"
        
            c.labTitle.text = titleArray[indexPath.row]
        
        case let c as CardBCell:
            let v = Int(arc4random_uniform(5))+1
            c.imgV.image = UIImage.init(named: "image\(v)")            
        case let c as CardCCell:
            c.clickCallBack {
                if let vc = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Second") as? SecondViewController {
                    vc.delegate = self
                    self.card.presentViewController(to: vc)
                }
            }
        default:
            return UICollectionViewCell()

    }
    return cell
}

@IBAction func filterAction () {
    let sheet = UIAlertController.init(title: "Filter", message: "Select you want to show in View", preferredStyle: .alert)

    sheet.addTextField(configurationHandler: nil)
    
    
    
    let byText = UIAlertAction(title: "Filter by text", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in
        self.card.filterAllDataWith(isInclued: { (idex, obj) -> Bool in
            let titleTxt = self.titleArray[idex]
            return titleTxt.lowercased().contains(sheet.textFields![0].text!)
        })
    })
    
    /*let cellA = UIAlertAction(title: "CellA", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in
        self.card.filterAllDataWith(isInclued: { (idex, obj) -> Bool in
            return (obj as! String) == "CardA"
        })
    })
    
    let cellB = UIAlertAction(title: "CellB", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in
        
        self.card.filterAllDataWith(isInclued: { (idex, obj) -> Bool in
            return (obj as! String) == "CardB"
        })
    })
    
    let cellC = UIAlertAction(title: "CellC", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in
        self.card.filterAllDataWith(isInclued: { (idex, obj) -> Bool in
            return (obj as! String) == "CardC"
        })
    })
    let ac = ["CardA","CardC"]
    let cellAC = UIAlertAction(title: "CellA,CellC", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in
        
        
        self.card.filterAllDataWith(isInclued: { (idex, obj) -> Bool in
            return ac.contains(obj as! String)
        })
    })*/
    
    let allCell = UIAlertAction(title: "Show all cells", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in
       self.card.showAllData()
    })
    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: {
        (alert: UIAlertAction!) -> Void in
    })
            
    //sheet.addAction(cellA)
    sheet.addAction(byText)
    /*sheet.addAction(cellB)
    sheet.addAction(cellC)
    sheet.addAction(cellAC)*/

    sheet.addAction(allCell)
    sheet.addAction(cancelAction)
    self.present(sheet, animated: true, completion: nil)
}

Now this is what I'm facing:

  1. You have a pile of the same type cards differentiating them only by some sort of text (all of these are stored in an array).
  2. You choose to filter those cards by some text, looking for the cards that contains that text you typed.
  3. The filtering is done properly.
  4. You choose to show all your cards, to go back to the original state.
  5. Apparently everything is okay, but some cards are duplicated and some are missing.

Can you help me with this?

Override default card height

Is there an API or a best practice to override default card height? The UI I have in mind is one that mimics Apple pay where cards are smaller.

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.