Add skill home

This commit is contained in:
kevinzhow
2015-05-06 21:57:12 +08:00
parent 8d0438e3cc
commit a8a302973f
12 changed files with 438 additions and 6 deletions
+40
View File
@@ -9,6 +9,10 @@
/* Begin PBXBuildFile section */
0A02E46F1AC9208A00235DBF /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A02E46E1AC9208A00235DBF /* libxml2.dylib */; };
0A0A11821AE389380008772C /* RegisterSkillsLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A0A11811AE389380008772C /* RegisterSkillsLayout.swift */; };
0A1CAC6B1AFA3D8900826B45 /* SkillHomeViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1CAC6A1AFA3D8900826B45 /* SkillHomeViewControllerExtension.swift */; };
0A1CAC6E1AFA42D400826B45 /* SkillHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1CAC6D1AFA42D400826B45 /* SkillHomeViewController.swift */; };
0A1CAC701AFA481600826B45 /* SkillHomeHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1CAC6F1AFA481600826B45 /* SkillHomeHeaderView.swift */; };
0A1CAC731AFA526200826B45 /* SkillHomeSectionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1CAC721AFA526200826B45 /* SkillHomeSectionButton.swift */; };
0A271FD71ACA055400822DFC /* YepAudioService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A271FD61ACA055400822DFC /* YepAudioService.swift */; };
0A3E60601ACCA9C0003DC853 /* String+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A3E605F1ACCA9C0003DC853 /* String+Yep.swift */; };
0A3E60671ACCAECE003DC853 /* YepLocationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A3E60661ACCAECE003DC853 /* YepLocationService.swift */; };
@@ -171,6 +175,10 @@
/* Begin PBXFileReference section */
0A02E46E1AC9208A00235DBF /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
0A0A11811AE389380008772C /* RegisterSkillsLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RegisterSkillsLayout.swift; path = ViewControllers/Register/RegisterSkillsLayout.swift; sourceTree = "<group>"; };
0A1CAC6A1AFA3D8900826B45 /* SkillHomeViewControllerExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillHomeViewControllerExtension.swift; path = ViewControllers/SkillPage/SkillHomeViewControllerExtension.swift; sourceTree = "<group>"; };
0A1CAC6D1AFA42D400826B45 /* SkillHomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillHomeViewController.swift; path = ViewControllers/SkillHome/SkillHomeViewController.swift; sourceTree = "<group>"; };
0A1CAC6F1AFA481600826B45 /* SkillHomeHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillHomeHeaderView.swift; path = Views/SkillHomeHeaderView/SkillHomeHeaderView.swift; sourceTree = "<group>"; };
0A1CAC721AFA526200826B45 /* SkillHomeSectionButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillHomeSectionButton.swift; path = Views/SkillHomeSectionButton/SkillHomeSectionButton.swift; sourceTree = "<group>"; };
0A271FD61ACA055400822DFC /* YepAudioService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepAudioService.swift; path = Services/YepAudioService.swift; sourceTree = "<group>"; };
0A3E605F1ACCA9C0003DC853 /* String+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+Yep.swift"; path = "Extensions/String+Yep.swift"; sourceTree = "<group>"; };
0A3E60661ACCAECE003DC853 /* YepLocationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepLocationService.swift; path = Services/YepLocationService.swift; sourceTree = "<group>"; };
@@ -362,6 +370,31 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0A1CAC6C1AFA3D8C00826B45 /* SkillPage */ = {
isa = PBXGroup;
children = (
0A1CAC6D1AFA42D400826B45 /* SkillHomeViewController.swift */,
0A1CAC6A1AFA3D8900826B45 /* SkillHomeViewControllerExtension.swift */,
);
name = SkillPage;
sourceTree = "<group>";
};
0A1CAC711AFA481900826B45 /* SkillHomeHeaderView */ = {
isa = PBXGroup;
children = (
0A1CAC6F1AFA481600826B45 /* SkillHomeHeaderView.swift */,
);
name = SkillHomeHeaderView;
sourceTree = "<group>";
};
0A1CAC741AFA526400826B45 /* SkillHomeSectionButton */ = {
isa = PBXGroup;
children = (
0A1CAC721AFA526200826B45 /* SkillHomeSectionButton.swift */,
);
name = SkillHomeSectionButton;
sourceTree = "<group>";
};
0A3E60631ACCAC02003DC853 /* NSDate+TimeAgo */ = {
isa = PBXGroup;
children = (
@@ -482,6 +515,7 @@
0A5D83951AC5D3CD000045BF /* TabBar */,
50894CF21AEA472B000981AF /* Settings */,
50894CFF1AEA5A7E000981AF /* EditProfile */,
0A1CAC6C1AFA3D8C00826B45 /* SkillPage */,
);
name = ViewControllers;
sourceTree = "<group>";
@@ -549,6 +583,8 @@
508D16BE1ADCAF0900270E3F /* PullToRefresh */,
50EB8CCC1AEA1AC5001AC1EE /* Media */,
50E61CEC1AF1F6A600908A9D /* ConversationTitle */,
0A1CAC711AFA481900826B45 /* SkillHomeHeaderView */,
0A1CAC741AFA526400826B45 /* SkillHomeSectionButton */,
);
name = Views;
sourceTree = "<group>";
@@ -1330,8 +1366,10 @@
508D17471ACCF4710092D666 /* ChatLeftAudioCell.swift in Sources */,
50894D021AEA6433000981AF /* EditProfileLessInfoCell.swift in Sources */,
50894CFA1AEA54BA000981AF /* SettingsMoreCell.swift in Sources */,
0A1CAC6B1AFA3D8900826B45 /* SkillHomeViewControllerExtension.swift in Sources */,
502AE51B1AB70DDB005BD199 /* WelcomeViewController.swift in Sources */,
50894D071AEDFDA2000981AF /* EditProfileMoreInfoCell.swift in Sources */,
0A1CAC731AFA526200826B45 /* SkillHomeSectionButton.swift in Sources */,
50E114F41ABBF9CC00F13000 /* Models.swift in Sources */,
5053AD551AF83B0F00B3CBFA /* ChatRightLocationCell.swift in Sources */,
50A9D4571ACD393A000B2599 /* YepWaverView.swift in Sources */,
@@ -1345,9 +1383,11 @@
5023DE591AB6DBC100B3EE96 /* UIImage+Yep.swift in Sources */,
50EB8CBF1AE89ED8001AC1EE /* ChatLeftVideoCell.swift in Sources */,
502AE5331AB86020005BD199 /* RegisterVerifyMobileViewController.swift in Sources */,
0A1CAC6E1AFA42D400826B45 /* SkillHomeViewController.swift in Sources */,
502AE5401AB88862005BD199 /* SkillRankCell.swift in Sources */,
50C090A01ADE391600CC6389 /* AddSkillsReusableView.swift in Sources */,
5023DE2D1AB685ED00B3EE96 /* DiscoverViewController.swift in Sources */,
0A1CAC701AFA481600826B45 /* SkillHomeHeaderView.swift in Sources */,
502AE53A1AB871C1005BD199 /* YepAlert.swift in Sources */,
5053AD4D1AF79EEA00B3CBFA /* UserPickedLocationPin.swift in Sources */,
50C0909D1ADE294800CC6389 /* RegisterPickSkillsLayout.swift in Sources */,
+52 -2
View File
@@ -511,11 +511,12 @@
<outlet property="sayHiButton" destination="g8r-Vj-XaN" id="Evy-hG-CXL"/>
<outlet property="sayHiView" destination="sfC-fv-gcr" id="5bd-hx-FGY"/>
<segue destination="la3-6z-2aH" kind="show" identifier="showConversation" id="o3b-2D-AMq"/>
<segue destination="3gg-0l-MYn" kind="show" identifier="showSkillHome" id="Jw0-fk-BDi"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9Oi-o8-uy7" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2027" y="1045"/>
<point key="canvasLocation" x="2011" y="1029"/>
</scene>
<!--Settings View Controller-->
<scene sceneID="qZs-Er-4wk">
@@ -553,7 +554,56 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="zuA-bP-KGx" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2769" y="1045"/>
<point key="canvasLocation" x="2793" y="1045"/>
</scene>
<!--Skill Home View Controller-->
<scene sceneID="kj4-Yg-Eog">
<objects>
<viewController id="3gg-0l-MYn" customClass="SkillHomeViewController" customModule="Yep" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Vlu-dB-Ukl"/>
<viewControllerLayoutGuide type="bottom" id="IIx-oj-clN"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="EQO-b7-KgY">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cmT-Gk-qyV" customClass="SkillHomeHeaderView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="600" height="160"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="160" id="zQ8-r2-xvU"/>
</constraints>
</view>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qu8-bN-78f">
<rect key="frame" x="0.0" y="160" width="600" height="391"/>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Qu8-bN-78f" firstAttribute="top" secondItem="cmT-Gk-qyV" secondAttribute="bottom" id="2yo-3H-MMt"/>
<constraint firstItem="cmT-Gk-qyV" firstAttribute="leading" secondItem="EQO-b7-KgY" secondAttribute="leading" id="9To-eb-Bk6"/>
<constraint firstAttribute="trailing" secondItem="cmT-Gk-qyV" secondAttribute="trailing" id="XdR-Xa-qcN"/>
<constraint firstAttribute="trailing" secondItem="Qu8-bN-78f" secondAttribute="trailing" id="fez-Gm-up4"/>
<constraint firstItem="Qu8-bN-78f" firstAttribute="leading" secondItem="EQO-b7-KgY" secondAttribute="leading" id="hTe-1J-M6S"/>
<constraint firstItem="Qu8-bN-78f" firstAttribute="bottom" secondItem="cmT-Gk-qyV" secondAttribute="bottom" id="hfd-P8-W1D"/>
<constraint firstItem="IIx-oj-clN" firstAttribute="top" secondItem="Qu8-bN-78f" secondAttribute="bottom" id="jVI-TZ-cD2"/>
<constraint firstItem="cmT-Gk-qyV" firstAttribute="top" secondItem="EQO-b7-KgY" secondAttribute="top" id="xdi-it-jhR"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="hfd-P8-W1D"/>
</mask>
</variation>
</view>
<connections>
<outlet property="headerView" destination="cmT-Gk-qyV" id="f7f-b5-C3d"/>
<outlet property="headerViewHeightLayoutConstraint" destination="zQ8-r2-xvU" id="X8C-Td-b6p"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="O7a-Xh-Uff" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2836" y="1913"/>
</scene>
<!--Edit Profile View Controller-->
<scene sceneID="l0f-Y7-OKE">
+4
View File
@@ -14,6 +14,10 @@ class YepConfig {
static let minMessageSampleViewWidth: CGFloat = 25.0
static let skillHomeHeaderViewHeight: CGFloat = 250.0
static let skillHomeHeaderButtonHeight: CGFloat = 50.0
class func clientType() -> Int {
// TODO: clientType
#if DEBUG
+6 -2
View File
@@ -14,11 +14,15 @@ extension UIFont {
}
class func skillTextFont() -> UIFont {
return UIFont(name: "Helvetica-Light", size: 14)!
return UIFont(name: "HelveticaNeue-Light", size: 14)!
}
class func skillTextLargeFont() -> UIFont {
return UIFont(name: "Helvetica-Light", size: 20)!
return UIFont(name: "HelveticaNeue-Light", size: 20)!
}
class func skillHomeTextLargeFont() -> UIFont {
return UIFont(name: "HelveticaNeue", size: 18)!
}
class func navigationBarTitleFont() -> UIFont {
+21
View File
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "Cover3.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

+1 -1
View File
@@ -522,7 +522,7 @@ func discoverUsers(#masterSkills: [String], #learningSkills: [String], #discover
let parse: JSONDictionary -> [DiscoveredUser]? = { data in
println("discoverUsers: \(data)")
// println("discoverUsers: \(data)")
if let usersData = data["users"] as? [JSONDictionary] {
@@ -25,7 +25,8 @@ class ProfileViewController: UIViewController {
@IBOutlet weak var sayHiView: UIView!
@IBOutlet weak var sayHiButton: UIButton!
var shouldBackToDefaultNavgationbar = true
let skillCellIdentifier = "SkillCell"
let headerCellIdentifier = "ProfileHeaderCell"
@@ -140,6 +141,11 @@ class ProfileViewController: UIViewController {
super.viewWillDisappear(animated)
if let navigationController = navigationController {
if !shouldBackToDefaultNavgationbar {
return
}
navigationController.navigationBar.backgroundColor = nil
navigationController.navigationBar.translucent = true
navigationController.navigationBar.shadowImage = nil
@@ -164,9 +170,19 @@ class ProfileViewController: UIViewController {
// MARK: Navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
shouldBackToDefaultNavgationbar = true
if segue.identifier == "showConversation" {
let vc = segue.destinationViewController as! ConversationViewController
vc.conversation = sender as! Conversation
} else if segue.identifier == "showSkillHome" {
if let cell = sender as? SkillCell {
let vc = segue.destinationViewController as! SkillHomeViewController
vc.skillName = cell.skillLabel.text
shouldBackToDefaultNavgationbar = false
}
}
}
@@ -512,6 +528,16 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
return CGSizeMake(collectionViewWidth, 0)
}
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
if indexPath.section == ProfileSection.Learning.rawValue || indexPath.section == ProfileSection.Master.rawValue {
let cell = collectionView.cellForItemAtIndexPath(indexPath) as! SkillCell
self.performSegueWithIdentifier("showSkillHome", sender: cell)
}
}
}
@@ -0,0 +1,110 @@
//
// SkillHomeViewController.swift
// Yep
//
// Created by kevinzhow on 15/5/6.
// Copyright (c) 2015 Catch Inc. All rights reserved.
//
import UIKit
class SkillHomeViewController: UIViewController {
var skillName: String? {
didSet {
self.title = skillName
}
}
@IBOutlet weak var headerView: SkillHomeHeaderView!
@IBOutlet weak var headerViewHeightLayoutConstraint: NSLayoutConstraint!
var discoveredMasterUsers = [DiscoveredUser]()
var discoveredLearningUsers = [DiscoveredUser]()
override func viewDidLoad() {
super.viewDidLoad()
if let skillNameString = skillName {
discoverUserBySkillName(skillNameString)
}
self.headerViewHeightLayoutConstraint.constant = YepConfig.skillHomeHeaderViewHeight
customTitleView()
// Do any additional setup after loading the view.
}
func customTitleView() {
var titleLabel = UILabel()
let textAttributes = [
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSFontAttributeName: UIFont.skillHomeTextLargeFont()
]
var titleAttr = NSMutableAttributedString(string: skillName!, attributes:textAttributes)
titleLabel.attributedText = titleAttr
titleLabel.textAlignment = NSTextAlignment.Center
titleLabel.backgroundColor = UIColor.yepTintColor()
titleLabel.sizeToFit()
titleLabel.bounds = CGRectInset(titleLabel.frame, -25.0, -4.0)
titleLabel.layer.cornerRadius = titleLabel.frame.size.height/2.0
titleLabel.layer.masksToBounds = true
self.navigationItem.titleView = titleLabel
}
func discoverUserBySkillName(skillName: String) {
discoverUsers(masterSkills: [skillName], learningSkills: [], discoveredUserSortStyle: .LastSignIn, failureHandler: { (reason, errorMessage) in
defaultFailureHandler(reason, errorMessage)
}, completion: { discoveredUsers in
self.discoveredMasterUsers = discoveredUsers
dispatch_async(dispatch_get_main_queue()) {
}
})
discoverUsers(masterSkills: [], learningSkills: [skillName], discoveredUserSortStyle: .LastSignIn, failureHandler: { (reason, errorMessage) in
defaultFailureHandler(reason, errorMessage)
}, completion: { discoveredUsers in
self.discoveredLearningUsers = discoveredUsers
dispatch_async(dispatch_get_main_queue()) {
}
})
}
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.
}
*/
}
@@ -0,0 +1,84 @@
//
// SkillPageTableViewController.swift
// Yep
//
// Created by kevinzhow on 15/5/6.
// Copyright (c) 2015 Catch Inc. All rights reserved.
//
import UIKit
extension SkillHomeViewController: UITableViewDelegate {
// MARK: - Table view data source
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 0
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 0
}
/*
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath) as! UITableViewCell
// Configure the cell...
return cell
}
*/
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the item to be re-orderable.
return true
}
*/
/*
// 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.
}
*/
}
@@ -0,0 +1,71 @@
//
// SkillHomeHeaderView.swift
// Yep
//
// Created by kevinzhow on 15/5/6.
// Copyright (c) 2015 Catch Inc. All rights reserved.
//
import UIKit
class SkillHomeHeaderView: UIView {
lazy var headerImageView: UIImageView = {
var tempImageView = UIImageView(frame: CGRectZero)
tempImageView.contentMode = UIViewContentMode.ScaleAspectFill
tempImageView.clipsToBounds = true
return tempImageView;
}()
lazy var masterButton: UIButton = {
var button = createSkillHomeButtonWithText("Master", 100, YepConfig.skillHomeHeaderButtonHeight)
return button
}()
lazy var learningButton: UIButton = {
var button = createSkillHomeButtonWithText("Learning", 100, YepConfig.skillHomeHeaderButtonHeight)
return button
}()
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
func setup() {
headerImageView.image = UIImage(named: "Cover3")
self.addSubview(headerImageView)
self.addSubview(masterButton)
self.addSubview(learningButton)
self.backgroundColor = UIColor.lightGrayColor()
}
override func layoutSubviews() {
headerImageView.frame = self.bounds
masterButton.frame = CGRectMake(0, self.frame.height - YepConfig.skillHomeHeaderButtonHeight, self.frame.size.width/2.0, YepConfig.skillHomeHeaderButtonHeight)
learningButton.frame = CGRectMake(masterButton.frame.size.width, self.frame.height - YepConfig.skillHomeHeaderButtonHeight, self.frame.size.width/2.0, YepConfig.skillHomeHeaderButtonHeight)
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/
}
@@ -0,0 +1,22 @@
//
// SkillHomeSectionButton.swift
// Yep
//
// Created by kevinzhow on 15/5/6.
// Copyright (c) 2015 Catch Inc. All rights reserved.
//
import UIKit
func createSkillHomeButtonWithText(text: String, width: CGFloat, height: CGFloat) -> UIButton {
var button = UIButton.buttonWithType(UIButtonType.Custom) as! UIButton
button.frame = CGRectMake(0, 0, width, height)
button.setTitle(text, forState: UIControlState.Normal)
button.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
button.backgroundColor = UIColor.whiteColor()
button.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
button.titleLabel?.font = UIFont.systemFontOfSize(16.0)
return button
}