Created
June 29, 2015 11:04
-
-
Save MickaelCruzDB/9d0150d966f213e80848 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ProductCell: UICollectionViewCell { | |
// The collection view cell's objects | |
var imageView: UIImageView! | |
var caption: UILabel! | |
var category : UILabel! | |
var bu : UILabel! | |
override func preferredLayoutAttributesFittingAttributes(layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes! { | |
return layoutAttributes | |
} | |
required init(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
} | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
// Create an ImageView and add it to the collection view | |
imageView = UIImageView(frame: CGRect(x:30, y:12, width:65, height:65)) | |
imageView.contentMode = UIViewContentMode.ScaleAspectFill | |
contentView.addSubview(imageView) | |
// Create a Label view and add it to the collection view | |
let textFrame = CGRect(x:12, y:67, width:100, height:55) | |
caption = UILabel(frame: textFrame) | |
caption.font = UIFont.systemFontOfSize(14.0) | |
caption.textAlignment = .Center | |
caption.numberOfLines = 2 | |
caption.lineBreakMode = NSLineBreakMode.ByWordWrapping | |
caption.textColor = UIColor.whiteColor() | |
caption.backgroundColor = UIColor.clearColor() | |
contentView.addSubview(caption) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment