Swift開發的Runkeeper設計開關控件:DGRunkeeperSwitch

jopen 9年前發布 | 12K 次閱讀 Apple Swift開發 DGRunkeeperSwitch

Swift開發的Runkeeper設計開關控件 (two part segment control)。

alt tag alt tag

Requirements

  • Xcode 7-beta or higher
  • iOS 8.0 or higher (May work on previous versions, just did not test it. Feel free to edit it).
  • ARC
  • Swift 2.0

Demo

Open and run the DGRunkeeperSwitchExample project in Xcode to see DGRunkeeperSwitch in action.

Installation

Manual

All you need to do is drop DGRunkeeperSwitch.swift file into your project

Example usage

let runkeeperSwitch = DGRunkeeperSwitch(leftTitle: "Feed", rightTitle: "Leaderboard")
runkeeperSwitch.backgroundColor = UIColor(red: 239.0/255.0, green: 95.0/255.0, blue: 49.0/255.0, alpha: 1.0)
runkeeperSwitch.selectedBackgroundColor = .whiteColor()
runkeeperSwitch.titleColor = .whiteColor()
runkeeperSwitch.selectedTitleColor = UIColor(red: 239.0/255.0, green: 95.0/255.0, blue: 49.0/255.0, alpha: 1.0)
runkeeperSwitch.titleFont = UIFont(name: "HelveticaNeue-Medium", size: 13.0)
runkeeperSwitch.frame = CGRect(x: 50.0, y: 20.0, width: view.bounds.width - 100.0, height: 30.0)
runkeeperSwitch.autoresizingMask = [.FlexibleWidth]
view.addSubview(runkeeperSwitch)

項目主頁:http://www.baiduhome.net/lib/view/home/1442056801758

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!