Skip to content

Commit

Permalink
closes #33
Browse files Browse the repository at this point in the history
  • Loading branch information
you wu committed Jul 7, 2016
1 parent 96ee84d commit ba5f2ab
Show file tree
Hide file tree
Showing 16 changed files with 457 additions and 3 deletions.
4 changes: 4 additions & 0 deletions GymBuddyUp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
C64EC2191D235F95000DA37A /* Create.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C64EC2171D235F95000DA37A /* Create.storyboard */; };
C64EC21D1D2AB97D000DA37A /* CreateMainVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C64EC21A1D235FCF000DA37A /* CreateMainVC.swift */; };
C64EC21F1D2AC014000DA37A /* PlanTableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C64EC21E1D2AC014000DA37A /* PlanTableView.xib */; };
C64EC2211D2DE81E000DA37A /* MeMainVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C64EC2201D2DE81E000DA37A /* MeMainVC.swift */; };
C65301E41D01F51E00DEF7A0 /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C65301E31D01F51E00DEF7A0 /* Validation.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -76,6 +77,7 @@
C64EC2181D235F95000DA37A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Create.storyboard; sourceTree = "<group>"; };
C64EC21A1D235FCF000DA37A /* CreateMainVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CreateMainVC.swift; path = VCs/CreateMainVC.swift; sourceTree = "<group>"; };
C64EC21E1D2AC014000DA37A /* PlanTableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PlanTableView.xib; path = Views/PlanTableView.xib; sourceTree = "<group>"; };
C64EC2201D2DE81E000DA37A /* MeMainVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeMainVC.swift; path = VCs/MeMainVC.swift; sourceTree = "<group>"; };
C65301E31D01F51E00DEF7A0 /* Validation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Helpers/Validation.swift; sourceTree = "<group>"; };
D1026416F0B8214F0B969DEE /* Pods-GymBuddyUp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GymBuddyUp.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GymBuddyUp/Pods-GymBuddyUp.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -170,6 +172,7 @@
C64EC2071D207D2B000DA37A /* DiscoverMainVC.swift */,
C64EC2151D20D997000DA37A /* TabBarVC.swift */,
C64EC21A1D235FCF000DA37A /* CreateMainVC.swift */,
C64EC2201D2DE81E000DA37A /* MeMainVC.swift */,
);
name = VCs;
sourceTree = "<group>";
Expand Down Expand Up @@ -360,6 +363,7 @@
C64EC1FC1D1B6B5A000DA37A /* GenderVC.swift in Sources */,
C649C56B1CE3EE0800258994 /* SignupVC.swift in Sources */,
C64EC20A1D207D69000DA37A /* PlanLibVC.swift in Sources */,
C64EC2211D2DE81E000DA37A /* MeMainVC.swift in Sources */,
C64EC2081D207D2B000DA37A /* DiscoverMainVC.swift in Sources */,
C649C56D1CE3F55E00258994 /* SetGoalVC.swift in Sources */,
C64EC2161D20D997000DA37A /* TabBarVC.swift in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions GymBuddyUp/Assets.xcassets/EditUser.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "EditUser.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions GymBuddyUp/Assets.xcassets/Group.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Group.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions GymBuddyUp/Assets.xcassets/selfie.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "selfie.jpg",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
285 changes: 282 additions & 3 deletions GymBuddyUp/Base.lproj/Me.storyboard

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions GymBuddyUp/VCs/MeMainVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//
// MeMainVC.swift
// GymBuddyUp
//
// Created by you wu on 7/6/16.
// Copyright © 2016 You Wu. All rights reserved.
//

import UIKit

class MeMainVC: UIViewController {

@IBOutlet weak var tableView: UITableView!
let kHeaderHeight:CGFloat = 130
let titleBGView: UIImageView = UIImageView()
let profileView : UIImageView = UIImageView()

let cells = ["ProfileCell", "BuddyCell", "WorkoutCell", "WorkoutHistoryCell"]

override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
tableView.estimatedRowHeight = 230
tableView.rowHeight = UITableViewAutomaticDimension
tableView.reloadData()
// Do any additional setup after loading the view.
setHeader()
}
func setHeader() {
titleBGView.image = UIImage(named: "selfie")
profileView.image = UIImage(named: "selfie")
let headerW = CGRectGetWidth(self.view.frame)


profileView.frame = CGRect(x: headerW/2 - headerW/6, y: kHeaderHeight/2, width: headerW/3, height: headerW/3)
profileView.clipsToBounds = true
profileView.contentMode = UIViewContentMode.ScaleAspectFill
profileView.layer.cornerRadius = headerW/6
profileView.layer.borderWidth = 2.0
profileView.layer.borderColor = ColorScheme.sharedInstance.navTint.CGColor

//title background
self.titleBGView.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.frame), kHeaderHeight)
self.titleBGView.contentMode = .ScaleAspectFill
self.titleBGView.clipsToBounds = true
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
//always fill the view
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = .FlexibleHeight
blurEffectView.alpha = 0.7
self.titleBGView.addSubview(blurEffectView)

let tableHeaderView = UIView(frame: CGRectMake(0, 0, headerW, kHeaderHeight))
tableHeaderView.backgroundColor = UIColor.flatWhiteColor()
tableHeaderView.addSubview(self.titleBGView)
tableHeaderView.addSubview(self.profileView)

self.tableView.backgroundColor = UIColor.clearColor()
self.tableView.tableHeaderView = tableHeaderView

}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/


}

extension MeMainVC: UITableViewDelegate, UITableViewDataSource {

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 6
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.row < 4 {
let cell = tableView.dequeueReusableCellWithIdentifier(cells[indexPath.row], forIndexPath: indexPath)
return cell
}else {
let cell = tableView.dequeueReusableCellWithIdentifier(cells[3], forIndexPath: indexPath)
return cell
}
}

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.row == 1 {
self.performSegueWithIdentifier("toBuddySegue", sender: self)
}
}

func scrollViewDidScroll(scrollView: UIScrollView) {
let yPos: CGFloat = -scrollView.contentOffset.y

if (yPos > 0) {
var imgRect: CGRect = self.titleBGView.frame
imgRect.origin.y = scrollView.contentOffset.y
imgRect.size.height = kHeaderHeight+yPos
self.titleBGView.frame = imgRect
}
}
}
Binary file added images/EditUser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/selfie.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ba5f2ab

Please sign in to comment.