From 61b0e4d250b6c6b3c107446c578da7a371b34092 Mon Sep 17 00:00:00 2001 From: Okechi Date: Thu, 28 Jan 2016 19:29:20 -0500 Subject: [PATCH] Almost finished restoring storyboard from 01/22/16 --- GetHip/FriendsCell.swift | 12 + GetHip/FriendsListViewController.swift | 66 +-- GetHip/HomeScreenViewController.swift | 1 + GetHip/Main.storyboard | 507 +++++++++++++++++++++-- GetHip/SettingsTableViewController.swift | 21 +- GetHip/SongSelectionViewController.swift | 2 +- 6 files changed, 537 insertions(+), 72 deletions(-) diff --git a/GetHip/FriendsCell.swift b/GetHip/FriendsCell.swift index 7c4cac9..0f71b9d 100644 --- a/GetHip/FriendsCell.swift +++ b/GetHip/FriendsCell.swift @@ -22,3 +22,15 @@ class FriendsCell: UITableViewCell { } } + +class FriendRequestCell: UITableViewCell { + + + override func awakeFromNib() { + super.awakeFromNib() + } + + override func setSelected(selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + } +} diff --git a/GetHip/FriendsListViewController.swift b/GetHip/FriendsListViewController.swift index ccdef7d..a57c34e 100644 --- a/GetHip/FriendsListViewController.swift +++ b/GetHip/FriendsListViewController.swift @@ -8,7 +8,7 @@ import UIKit -class FriendsListViewController: UITableViewController/*PFQueryTableViewController*/ { +class FriendsListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource/*PFQueryTableViewController*/ { //var manager = FriendDataSource() var friends = [] @@ -28,6 +28,7 @@ class FriendsListViewController: UITableViewController/*PFQueryTableViewControll super.viewDidLoad() self.table.delegate = self self.table.dataSource = self + self.title = "Friends" //self.navigationItem.rightBarButtonItem = self.editButtonItem() //self.friends = manager.getFriends() @@ -46,41 +47,52 @@ class FriendsListViewController: UITableViewController/*PFQueryTableViewControll super.didReceiveMemoryWarning() } - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { + func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 1 } - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return self.friends.count + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return self.friends.count + 1 } - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let friend = self.friends[indexPath.row] as? FriendData - let cell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as? FriendsCell - - //sets display name of friend (print for debugging purposes) - cell!.friendName.text = friend!.displayName - println(friend!.displayName) + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - //sets profile image of current cell - //checks if friend user has a profile image or not - if friend?.profileImg == nil { - cell!.proImage.backgroundColor = UIColor.grayColor() + if( indexPath.row == 0){ + let cell = self.table.dequeueReusableCellWithIdentifier("RequestCell", forIndexPath: indexPath) as? FriendRequestCell + + return cell! + } else{ - + + let friend = self.friends[indexPath.row - 1] as? FriendData + let cell = self.table.dequeueReusableCellWithIdentifier("FriendCell", forIndexPath: indexPath) as? FriendsCell + + //sets display name of friend (print for debugging purposes) + cell!.friendName.text = friend!.displayName + //println(friend!.displayName) + + //sets profile image of current cell + //checks if friend user has a profile image or not + if friend?.profileImg == nil { + cell!.proImage.backgroundColor = UIColor.grayColor() + } + else{ + + } + + //rounds uiimage and configures UIImageView + //cell!.proImage.layer.borderWidth = 3.0 + //cell!.proImage.clipsToBounds = true + cell!.proImage.layer.cornerRadius = cell!.proImage.frame.size.width/2 + + //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor + //cell!.proImage.layer.masksToBounds = true + + + return cell! } - //rounds uiimage and configures UIImageView - //cell!.proImage.layer.borderWidth = 3.0 - //cell!.proImage.clipsToBounds = true - cell!.proImage.layer.cornerRadius = cell!.proImage.frame.size.width/2 - - //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor - //cell!.proImage.layer.masksToBounds = true - - - return cell! } override func setEditing(editing: Bool, animated: Bool) { @@ -91,7 +103,7 @@ class FriendsListViewController: UITableViewController/*PFQueryTableViewControll } } - override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { + func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { switch editingStyle { case .Delete: //delete friend from users friend array, parse, and tableView diff --git a/GetHip/HomeScreenViewController.swift b/GetHip/HomeScreenViewController.swift index 584b213..9633b68 100644 --- a/GetHip/HomeScreenViewController.swift +++ b/GetHip/HomeScreenViewController.swift @@ -42,6 +42,7 @@ class HomeScreenViewController: UIViewController { self.view.backgroundColor = UIColor.whiteColor() CreateAPartyBtn.layer.cornerRadius = 5 CreateAPartyBtn.layer.borderWidth = 1 + self.navigationController?.navigationBarHidden = true NSNotificationCenter.defaultCenter().addObserver(self, selector: "loadID:", name: "gotDisplayID", object: nil) diff --git a/GetHip/Main.storyboard b/GetHip/Main.storyboard index 8a918da..5b66ff8 100644 --- a/GetHip/Main.storyboard +++ b/GetHip/Main.storyboard @@ -2,7 +2,6 @@ - @@ -27,6 +26,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -47,20 +162,9 @@ - - + - - - - - - - - @@ -114,10 +219,10 @@ - + - + @@ -126,38 +231,213 @@ + - + - + + + + + + + + - + + + + + + + + - + + + + + + + + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -165,12 +445,169 @@ - + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GetHip/SettingsTableViewController.swift b/GetHip/SettingsTableViewController.swift index f93415e..60af396 100644 --- a/GetHip/SettingsTableViewController.swift +++ b/GetHip/SettingsTableViewController.swift @@ -8,7 +8,7 @@ import UIKit -class SettingsTableViewController: UITableViewController { +class SettingsTableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { // var manager = UserParseDataSource() var user = [] @@ -39,11 +39,13 @@ class SettingsTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - self.navigationItem.title = "Settings" + self.title = "Settings" self.logOutBtn.layer.borderWidth = 1 self.logOutBtn.layer.cornerRadius = 5 self.logOutBtn.layer.borderColor = UIColor.blackColor().CGColor + self.table.dataSource = self + self.table.delegate = self //NSNotificationCenter.defaultCenter().addObserver(self, selector: "refreshTable:", name: "refreshSettingsView", object: nil) @@ -62,7 +64,7 @@ class SettingsTableViewController: UITableViewController { // MARK: - Table view data source - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { + func numberOfSectionsInTableView(tableView: UITableView) -> Int { // #warning Potentially incomplete method implementation. // Return the number of sections. return 1 @@ -70,17 +72,17 @@ class SettingsTableViewController: UITableViewController { - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // #warning Incomplete method implementation. // Return the number of rows in the section. return 5 } - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { println(indexPath.row) switch indexPath.row { case 0: - let cell = (self.tableView.dequeueReusableCellWithIdentifier("DispNameCell", forIndexPath: indexPath) as? DisplayNameCell)! + let cell = (self.table.dequeueReusableCellWithIdentifier("DispNameCell", forIndexPath: indexPath) as? DisplayNameCell)! if self.user.count > 0 { cell.dispName.text = (self.user[0] as? UserParseData)!.displayName @@ -89,7 +91,7 @@ class SettingsTableViewController: UITableViewController { return cell case 1: - let cell = (self.tableView.dequeueReusableCellWithIdentifier("UserNameCell", forIndexPath: indexPath) as? UserNameCell)! + let cell = (self.table.dequeueReusableCellWithIdentifier("UserNameCell", forIndexPath: indexPath) as? UserNameCell)! if self.user.count > 0 { cell.usrName.text = (self.user[0] as? UserParseData)!.username @@ -98,7 +100,7 @@ class SettingsTableViewController: UITableViewController { return cell case 2: - let cell = (self.tableView.dequeueReusableCellWithIdentifier("EmailCell", forIndexPath: indexPath) as? EmailCell)! + let cell = (self.table.dequeueReusableCellWithIdentifier("EmailCell", forIndexPath: indexPath) as? EmailCell)! if self.user.count > 0 { cell.email.text = (self.user[0] as? UserParseData)!.email @@ -122,9 +124,10 @@ class SettingsTableViewController: UITableViewController { return cell } + } - override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { + func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { switch indexPath.row { diff --git a/GetHip/SongSelectionViewController.swift b/GetHip/SongSelectionViewController.swift index cba6355..d02a856 100644 --- a/GetHip/SongSelectionViewController.swift +++ b/GetHip/SongSelectionViewController.swift @@ -74,7 +74,7 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl super.viewDidLoad() self.table.delegate = self self.table.dataSource = self - + self.title = "Select a Song" // Do any additional setup after loading the view. }