diff --git a/Yep/Images.xcassets/feed_container_background.imageset/Contents.json b/Yep/Images.xcassets/feed_container_background.imageset/Contents.json new file mode 100644 index 00000000..c0abd5b3 --- /dev/null +++ b/Yep/Images.xcassets/feed_container_background.imageset/Contents.json @@ -0,0 +1,26 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "feed_container_background.pdf", + "resizing" : { + "mode" : "9-part", + "center" : { + "mode" : "tile", + "width" : 1, + "height" : 1 + }, + "cap-insets" : { + "bottom" : 5, + "top" : 5, + "right" : 5, + "left" : 5 + } + } + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/feed_container_background.imageset/feed_container_background.pdf b/Yep/Images.xcassets/feed_container_background.imageset/feed_container_background.pdf new file mode 100644 index 00000000..8052f688 Binary files /dev/null and b/Yep/Images.xcassets/feed_container_background.imageset/feed_container_background.pdf differ diff --git a/Yep/Views/ContainerViews/FeedGithubRepoContainerView.swift b/Yep/Views/ContainerViews/FeedGithubRepoContainerView.swift index 8e0e68f8..f77a8fe0 100644 --- a/Yep/Views/ContainerViews/FeedGithubRepoContainerView.swift +++ b/Yep/Views/ContainerViews/FeedGithubRepoContainerView.swift @@ -12,6 +12,12 @@ class FeedGithubRepoContainerView: UIView { var tapAction: (() -> Void)? + lazy var backgroundImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = UIImage(named: "feed_container_background") + return imageView + }() + lazy var iconImageView: UIImageView = { let imageView = UIImageView() imageView.image = UIImage(named: "icon_repo") @@ -51,23 +57,34 @@ class FeedGithubRepoContainerView: UIView { private func makeUI() { + backgroundColor = UIColor.whiteColor() + tintAdjustmentMode = .Normal + + addSubview(backgroundImageView) addSubview(iconImageView) addSubview(nameLabel) addSubview(descriptionLabel) addSubview(accessoryImageView) + backgroundImageView.translatesAutoresizingMaskIntoConstraints = false iconImageView.translatesAutoresizingMaskIntoConstraints = false nameLabel.translatesAutoresizingMaskIntoConstraints = false descriptionLabel.translatesAutoresizingMaskIntoConstraints = false accessoryImageView.translatesAutoresizingMaskIntoConstraints = false let views = [ + "backgroundImageView": backgroundImageView, "iconImageView": iconImageView, "nameLabel": nameLabel, "descriptionLabel": descriptionLabel, "accessoryImageView": accessoryImageView, ] + let backgroundH = NSLayoutConstraint.constraintsWithVisualFormat("H:|[backgroundImageView]|", options: [], metrics: nil, views: views) + let backgroundV = NSLayoutConstraint.constraintsWithVisualFormat("V:|[backgroundImageView]|", options: [], metrics: nil, views: views) + NSLayoutConstraint.activateConstraints(backgroundH) + NSLayoutConstraint.activateConstraints(backgroundV) + let constraintsH = NSLayoutConstraint.constraintsWithVisualFormat("H:|-10-[iconImageView(16)]-10-[nameLabel]-5-[accessoryImageView(8)]-10-|", options: [], metrics: nil, views: views) iconImageView.setContentHuggingPriority(UILayoutPriorityDefaultHigh, forAxis: .Horizontal)