Open graemesi opened 9 years ago
Hi, look at this. https://mikeash.com/pyblog/custom-nscells-done-right.html
BTW thanks for filling this issue, I'm not that good in Cocoa and its about a week ago I've stubled upon this issue. Not knowing what caused it was making me mad :D
I'm still not quite sure how to use PXSourceList correctly. Do we have to manually generate the BadgeView in IB and size it? Here is my current process:
At this point everything still looks the same as before, and there is no BadgeView in MainCell, not even an outlet. Am I missing something here? @Miirek, did you end up doing that subclass thing in the custom-nscells-done-right link? Should I be manually creating the Badgeview, and hooking up the outlet?
same issue with subclass the PXSourceListTableCellView
func configCell(tag: Tag){
textField?.stringValue = tag.name
imageView?.image = NSImage.fontAwesomeIconWithName(.Tag, textColor: .lightGray, size: CGSize(width: 40, height: 40), backgroundColor: .clear)
badgeView.badgeValue = UInt(tag.starsCount)
badgeView.isHidden = tag.likeCount == 0
badgeView.textColor = .red
badgeView.backgroundColor = .blue
}
I just found a tricky approach that works fine for me (Swift 4, storyboard)
For view-based mode, OS X 10.10.3, running Xcode 6.4:
When a PXSourceListTableCellView is designed inside a storyboard, the badge view is never displayed. The same behaviour is seen if loaded from a xib and the "Prefer coder" option is checked in Interface Builder. You can see this behaviour by checking the "Prefer coder" option for the MainMenu.xib in the ViewBasedSourceList demo project.
I believe this is because the underlying PXSourceListBadgeCell is never initialised due to the way the storyboard or nib is loaded via the initWithCoder: path.