diff --git a/GymBuddyUp.xcodeproj/project.pbxproj b/GymBuddyUp.xcodeproj/project.pbxproj index cc58ed8..9519b29 100644 --- a/GymBuddyUp.xcodeproj/project.pbxproj +++ b/GymBuddyUp.xcodeproj/project.pbxproj @@ -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 */ @@ -76,6 +77,7 @@ C64EC2181D235F95000DA37A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Create.storyboard; sourceTree = ""; }; C64EC21A1D235FCF000DA37A /* CreateMainVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CreateMainVC.swift; path = VCs/CreateMainVC.swift; sourceTree = ""; }; C64EC21E1D2AC014000DA37A /* PlanTableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PlanTableView.xib; path = Views/PlanTableView.xib; sourceTree = ""; }; + C64EC2201D2DE81E000DA37A /* MeMainVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeMainVC.swift; path = VCs/MeMainVC.swift; sourceTree = ""; }; C65301E31D01F51E00DEF7A0 /* Validation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Helpers/Validation.swift; sourceTree = ""; }; 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 = ""; }; /* End PBXFileReference section */ @@ -170,6 +172,7 @@ C64EC2071D207D2B000DA37A /* DiscoverMainVC.swift */, C64EC2151D20D997000DA37A /* TabBarVC.swift */, C64EC21A1D235FCF000DA37A /* CreateMainVC.swift */, + C64EC2201D2DE81E000DA37A /* MeMainVC.swift */, ); name = VCs; sourceTree = ""; @@ -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 */, diff --git a/GymBuddyUp/Assets.xcassets/EditUser.imageset/Contents.json b/GymBuddyUp/Assets.xcassets/EditUser.imageset/Contents.json new file mode 100644 index 0000000..2198ed5 --- /dev/null +++ b/GymBuddyUp/Assets.xcassets/EditUser.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "EditUser.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "EditUser@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/GymBuddyUp/Assets.xcassets/EditUser.imageset/EditUser.png b/GymBuddyUp/Assets.xcassets/EditUser.imageset/EditUser.png new file mode 100644 index 0000000..edcdcbb Binary files /dev/null and b/GymBuddyUp/Assets.xcassets/EditUser.imageset/EditUser.png differ diff --git a/GymBuddyUp/Assets.xcassets/EditUser.imageset/EditUser@2x.png b/GymBuddyUp/Assets.xcassets/EditUser.imageset/EditUser@2x.png new file mode 100644 index 0000000..bc5d647 Binary files /dev/null and b/GymBuddyUp/Assets.xcassets/EditUser.imageset/EditUser@2x.png differ diff --git a/GymBuddyUp/Assets.xcassets/Group.imageset/Contents.json b/GymBuddyUp/Assets.xcassets/Group.imageset/Contents.json new file mode 100644 index 0000000..9897f63 --- /dev/null +++ b/GymBuddyUp/Assets.xcassets/Group.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Group.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Group@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/GymBuddyUp/Assets.xcassets/Group.imageset/Group.png b/GymBuddyUp/Assets.xcassets/Group.imageset/Group.png new file mode 100644 index 0000000..ae53312 Binary files /dev/null and b/GymBuddyUp/Assets.xcassets/Group.imageset/Group.png differ diff --git a/GymBuddyUp/Assets.xcassets/Group.imageset/Group@2x.png b/GymBuddyUp/Assets.xcassets/Group.imageset/Group@2x.png new file mode 100644 index 0000000..33ee9c3 Binary files /dev/null and b/GymBuddyUp/Assets.xcassets/Group.imageset/Group@2x.png differ diff --git a/GymBuddyUp/Assets.xcassets/selfie.imageset/Contents.json b/GymBuddyUp/Assets.xcassets/selfie.imageset/Contents.json new file mode 100644 index 0000000..81616eb --- /dev/null +++ b/GymBuddyUp/Assets.xcassets/selfie.imageset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "selfie.jpg", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GymBuddyUp/Assets.xcassets/selfie.imageset/selfie.jpg b/GymBuddyUp/Assets.xcassets/selfie.imageset/selfie.jpg new file mode 100644 index 0000000..d467423 Binary files /dev/null and b/GymBuddyUp/Assets.xcassets/selfie.imageset/selfie.jpg differ diff --git a/GymBuddyUp/Base.lproj/Me.storyboard b/GymBuddyUp/Base.lproj/Me.storyboard index 632eedd..0e92b0c 100644 --- a/GymBuddyUp/Base.lproj/Me.storyboard +++ b/GymBuddyUp/Base.lproj/Me.storyboard @@ -1,27 +1,306 @@ - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GymBuddyUp/VCs/MeMainVC.swift b/GymBuddyUp/VCs/MeMainVC.swift new file mode 100644 index 0000000..fea3c9f --- /dev/null +++ b/GymBuddyUp/VCs/MeMainVC.swift @@ -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 + } + } +} \ No newline at end of file diff --git a/images/EditUser.png b/images/EditUser.png new file mode 100644 index 0000000..edcdcbb Binary files /dev/null and b/images/EditUser.png differ diff --git a/images/EditUser@2x.png b/images/EditUser@2x.png new file mode 100644 index 0000000..bc5d647 Binary files /dev/null and b/images/EditUser@2x.png differ diff --git a/images/Group.png b/images/Group.png new file mode 100644 index 0000000..ae53312 Binary files /dev/null and b/images/Group.png differ diff --git a/images/Group@2x.png b/images/Group@2x.png new file mode 100644 index 0000000..33ee9c3 Binary files /dev/null and b/images/Group@2x.png differ diff --git a/images/selfie.jpg b/images/selfie.jpg new file mode 100644 index 0000000..d467423 Binary files /dev/null and b/images/selfie.jpg differ