From 2eff07c76a8cabfcd2c043666aee6366eacfaa0b Mon Sep 17 00:00:00 2001 From: Kristijan Perusko Date: Wed, 3 Feb 2016 18:11:36 -0500 Subject: [PATCH] #89 Added prototype header cell for the Home screen --- .../Base.lproj/Main.storyboard | 101 +++++++++++++++++- .../Views/HomeViewController.swift | 34 +----- 2 files changed, 101 insertions(+), 34 deletions(-) diff --git a/DesignStudioExpress/Base.lproj/Main.storyboard b/DesignStudioExpress/Base.lproj/Main.storyboard index 09d1700..e98e30d 100644 --- a/DesignStudioExpress/Base.lproj/Main.storyboard +++ b/DesignStudioExpress/Base.lproj/Main.storyboard @@ -1076,7 +1076,7 @@ Sketching Templates - + @@ -1085,33 +1085,123 @@ Sketching Templates + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4627,14 +4717,12 @@ Sketching Templates - - @@ -4646,7 +4734,6 @@ Sketching Templates - @@ -4658,11 +4745,13 @@ Sketching Templates + + @@ -4673,8 +4762,10 @@ Sketching Templates + + @@ -4685,8 +4776,10 @@ Sketching Templates + + diff --git a/DesignStudioExpress/Views/HomeViewController.swift b/DesignStudioExpress/Views/HomeViewController.swift index 8c9bac5..e90f72f 100644 --- a/DesignStudioExpress/Views/HomeViewController.swift +++ b/DesignStudioExpress/Views/HomeViewController.swift @@ -54,12 +54,14 @@ class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDe func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { if indexPath.row == 0 { - let cell = self.createCell("photoCell", indexPath: indexPath, MGSwipeTableCellCentered.self) - self.stylePhotoCell(cell, indexPath: indexPath) + let cell = self.createCell("photoCell", indexPath: indexPath, UITableViewCell.self) + //self.stylePhotoCell(cell, indexPath: indexPath) return cell } let cell = self.createCell("swipeCell", indexPath: indexPath, MGSwipeTableCellCentered.self) + cell.textLabel?.text = vm.getTitle(indexPath) + cell.detailTextLabel?.text = vm.getDetail(indexPath) cell.delegate = self self.styleSwipeCell(cell, indexPath: indexPath) @@ -185,9 +187,6 @@ class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDe cell = T(style: UITableViewCellStyle.Subtitle, reuseIdentifier: reuseIdentifier) } - cell.textLabel!.text = vm.getTitle(indexPath) - cell.detailTextLabel!.text = vm.getDetail(indexPath) - return cell } @@ -209,31 +208,6 @@ class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDe self.createButton.addSubview(lineView) } - func stylePhotoCell(cell: MGSwipeTableCellCentered, indexPath: NSIndexPath) { - // set the background image - let image = UIImage(named: vm.getImageName(indexPath)) - let imageView = UIImageView(image: image) - imageView.clipsToBounds = true - imageView.contentMode = .ScaleAspectFill - cell.backgroundView = imageView - - // style title - // TODO change to constant from DesignStudioStyle - cell.textLabel?.textColor = UIColor(red:0.53, green:0.65, blue:0.82, alpha:1.0) - cell.textLabel?.font = UIFont(name: "Avenir-Heavy", size: 14) - cell.textLabel?.attributedText = NSAttributedString.attributedStringWithSpacing(cell.textLabel!.attributedText!, kerning: 2.5) - - // style detail - cell.detailTextLabel?.textColor = DesignStudioStyles.white - cell.detailTextLabel?.font = UIFont(name: "Avenir-Light", size: 22) - cell.detailTextLabel?.lineBreakMode = .ByWordWrapping - cell.detailTextLabel?.numberOfLines = 0 - cell.detailTextLabel?.sizeToFit() - - // disable user interactions so we don't have highlighted state - cell.userInteractionEnabled = false - } - func styleSwipeCell(cell: MGSwipeTableCellCentered, indexPath: NSIndexPath) { // no highlighted color so that we don't have higlighted cell // when we go back