Skip to content

Commit

Permalink
Merge pull request hyperoslo#176 from richardtop/improving-stack-view
Browse files Browse the repository at this point in the history
Improving stack view
  • Loading branch information
onmyway133 authored Jul 25, 2016
2 parents 3ae081f + 401058e commit 37debb5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Source/BottomView/StackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ImageStackView: UIView {

var views: [UIImageView] = {
var array = [UIImageView]()
for i in 0...3 {
for _ in 0...3 {
let view = UIImageView()
view.layer.cornerRadius = 3
view.layer.borderColor = UIColor.whiteColor().CGColor
Expand All @@ -45,7 +45,6 @@ class ImageStackView: UIView {
views.forEach { addSubview($0) }
addSubview(activityView)
views.first?.alpha = 1
layoutSubviews()
}

required init?(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -128,9 +127,9 @@ extension ImageStackView {

func renderViews(assets: [PHAsset]) {
if let firstView = views.first where assets.isEmpty {
for imageView in views {
imageView.image = nil
imageView.alpha = 0
views.forEach{
$0.image = nil
$0.alpha = 0
}

firstView.alpha = 1
Expand All @@ -152,8 +151,7 @@ extension ImageStackView {

if index == photos.count {
UIView.animateWithDuration(0.3) {
self.activityView.frame.origin.x = view.center.x + 3
self.activityView.frame.origin.y = view.center.y + 3
self.activityView.frame.origin = CGPoint(x: view.center.x + 3, y: view.center.x + 3)
}
}
}
Expand Down

0 comments on commit 37debb5

Please sign in to comment.