├── .DS_Store
├── DVActionSheetDemo
├── ScreenShots
│ └── IMG_1625.PNG
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── ViewController.swift
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── AppDelegate.swift
└── DVActionSheetVC.swift
├── DVActionSheetDemo.xcodeproj
├── xcuserdata
│ ├── davidyu.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── lihualei.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── DVActionSheetDemo.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ ├── davidyu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ └── lihualei.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── project.pbxproj
├── DVActionSheetVC.podspec
├── README.md
├── DVActionSheetDemoTests
├── Info.plist
└── DVActionSheetDemoTests.swift
└── DVActionSheetDemoUITests
├── Info.plist
└── DVActionSheetDemoUITests.swift
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CreatFish/DVActionSheetVC/HEAD/.DS_Store
--------------------------------------------------------------------------------
/DVActionSheetDemo/ScreenShots/IMG_1625.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CreatFish/DVActionSheetVC/HEAD/DVActionSheetDemo/ScreenShots/IMG_1625.PNG
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/xcuserdata/davidyu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/xcuserdata/lihualei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/project.xcworkspace/xcuserdata/davidyu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CreatFish/DVActionSheetVC/HEAD/DVActionSheetDemo.xcodeproj/project.xcworkspace/xcuserdata/davidyu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/project.xcworkspace/xcuserdata/lihualei.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CreatFish/DVActionSheetVC/HEAD/DVActionSheetDemo.xcodeproj/project.xcworkspace/xcuserdata/lihualei.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/xcuserdata/davidyu.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | DVActionSheetDemo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | DVActionSheetDemo.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/DVActionSheetVC.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 |
3 | s.name = "DVActionSheetVC" #存储库名称
4 | s.version = "1.0.0" #版本号,与tag值一致
5 | s.summary = "Action Sheet" #简介
6 | s.description = "一个自用的仿微信actionsheet" #描述
7 | s.homepage = "https://github.com/CreatFish/DVActionSheetVC" #项目主页,不是git地址
8 | s.author = { "GreatFish" => "654070281@qq.com" } #作者
9 | s.platform = :ios, "8.0" #支持的平台和版本号
10 | s.source = { :git => "https://github.com/CreatFish/DVActionSheetVC.git", :tag => "1.0.0" } #存储库的git地址,以及tag值
11 | s.source_files = "DVActionSheetDemo/DVActionSheetVC.swift"
12 | s.requires_arc = true #是否支持ARC
13 | s.swift_version = "4.2"
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DVActionSheetVC
2 | 一个仿微信的actionsheet,使用简单
3 | 重写了转场动画,使用的时候直接present即可。
4 |
5 | 项目截图
6 |
7 |
8 | ## 一. Installation 安装
9 | 手动导入:直接将DVActionSheetVC.swift文件拽入项目中即可
10 |
11 | ## 二. Example 例子
12 |
13 | let vc = DVActionSheetVC()
14 |
15 | // 你可以通过block或者代理,来获取用户点击的选项.
16 | vc.finishSelect = { (index) in
17 |
18 | }
19 | vc.moreButtonTitles = ["测试","测试","测试"]
20 | self.present(vc, animated: true, completion: nil)
21 |
22 | ## 三. Requirements 要求
23 | iOS8及以上系统可使用. ARC环境.
24 |
25 | ## 四. More 更多
26 | 如果你发现了bug,请与我联系,邮箱: 654070281@qq.com
27 |
--------------------------------------------------------------------------------
/DVActionSheetDemoTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/DVActionSheetDemoUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/DVActionSheetDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/xcuserdata/lihualei.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | DVActionSheetDemo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 4B6EB1C11F53B0D4005BADFE
16 |
17 | primary
18 |
19 |
20 | 4B6EB1D51F53B0D4005BADFE
21 |
22 | primary
23 |
24 |
25 | 4B6EB1E01F53B0D4005BADFE
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/DVActionSheetDemoTests/DVActionSheetDemoTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DVActionSheetDemoTests.swift
3 | // DVActionSheetDemoTests
4 | //
5 | // Created by LIHUA LEI on 2017/8/28.
6 | // Copyright © 2017年 david. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import DVActionSheetDemo
11 |
12 | class DVActionSheetDemoTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measure {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/DVActionSheetDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/DVActionSheetDemo/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // DVActionSheetDemo
4 | //
5 | // Created by David Yu on 2017/8/28.
6 | // Copyright © 2017年 david. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 | // Do any additional setup after loading the view, typically from a nib.
16 | }
17 |
18 | override func didReceiveMemoryWarning() {
19 | super.didReceiveMemoryWarning()
20 | // Dispose of any resources that can be recreated.
21 |
22 | }
23 |
24 | @IBAction func showActionSheet(_ sender: UIButton) {
25 | let vc = DVActionSheetVC()
26 | // vc.delegate = self
27 | // 你可以通过block或者代理,来获取用户点击的选项.
28 | vc.finishSelect = { (index) in
29 | print("选中了第\(index)个选项")
30 | }
31 | vc.headerTitle = "是否退出登录?"
32 | vc.footerTitle = "取消"
33 | vc.cellTitleColor = UIColor.red
34 | vc.moreButtonTitles = ["退出登录"]
35 | self.present(vc, animated: true, completion: nil)
36 | }
37 |
38 | }
39 |
40 | extension ViewController: DVActionSheetVCDelegate {
41 | func dvActionSheetVC(_ actionSheetVC: DVActionSheetVC, clickedButtonAt buttonIndex: Int) {
42 | print("选中了第\(buttonIndex)个选项")
43 | }
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/DVActionSheetDemoUITests/DVActionSheetDemoUITests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DVActionSheetDemoUITests.swift
3 | // DVActionSheetDemoUITests
4 | //
5 | // Created by LIHUA LEI on 2017/8/28.
6 | // Copyright © 2017年 david. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class DVActionSheetDemoUITests: XCTestCase {
12 |
13 | override func setUp() {
14 | super.setUp()
15 |
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 |
18 | // In UI tests it is usually best to stop immediately when a failure occurs.
19 | continueAfterFailure = false
20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
21 | XCUIApplication().launch()
22 |
23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
24 | }
25 |
26 | override func tearDown() {
27 | // Put teardown code here. This method is called after the invocation of each test method in the class.
28 | super.tearDown()
29 | }
30 |
31 | func testExample() {
32 | // Use recording to get started writing UI tests.
33 | // Use XCTAssert and related functions to verify your tests produce the correct results.
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/DVActionSheetDemo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/DVActionSheetDemo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // DVActionSheetDemo
4 | //
5 | // Created by David Yu on 2017/8/28.
6 | // Copyright © 2017年 david. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/DVActionSheetDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/xcuserdata/lihualei.xcuserdatad/xcschemes/DVActionSheetDemo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/DVActionSheetDemo/DVActionSheetVC.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DVActionSheetVC.swift
3 | // DVActionSheetDemo
4 | //
5 | // Created by David Yu on 2017/8/28.
6 | // Copyright © 2017年 david. All rights reserved.
7 | //
8 |
9 | public protocol DVActionSheetVCDelegate {
10 | func dvActionSheetVC(_ actionSheetVC: DVActionSheetVC, clickedButtonAt buttonIndex: Int)
11 | }
12 |
13 | import UIKit
14 |
15 | // 背景颜色
16 | let kActionSheetBGColor = UIColor(red: 231/255.0, green: 231/255.0, blue: 231/255.0, alpha: 1)
17 | // 字体颜色
18 | let kActionSheetTextColor = UIColor(red: 51/255.0, green: 51/255.0, blue: 51/255.0, alpha: 1)
19 | // actionBtn高度
20 | let kActionSheetCellHeight: CGFloat = 55
21 |
22 | public class DVActionSheetVC: UIViewController {
23 |
24 | public var delegate: DVActionSheetVCDelegate?
25 | lazy var actionSheet: UITableView! = {
26 | let table = UITableView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height))
27 | self.view.addSubview(table)
28 | table.showsVerticalScrollIndicator = false
29 | table.backgroundColor = kActionSheetBGColor
30 | table.delegate = self
31 | table.dataSource = self
32 | table.bounces = false
33 | table.separatorStyle = UITableViewCell.SeparatorStyle.none
34 | table.register(DVActionCell.classForCoder(), forCellReuseIdentifier: "DVActionCell")
35 | table.register(DVActionFooter.classForCoder(), forHeaderFooterViewReuseIdentifier: "DVActionFooter")
36 | table.register(DVActionHeader.classForCoder(), forHeaderFooterViewReuseIdentifier: "DVActionHeader")
37 | return table
38 | }()
39 |
40 | /*!
41 | 完成回调
42 |
43 | @discussion 可使用代理或者block,若实现了block将不会执行代理
44 | */
45 | public var finishSelect: ((Int)->Void)?
46 |
47 | public var headerTitleColor: UIColor = UIColor.lightGray {
48 | didSet {
49 | reloadActionSheet()
50 | }
51 | }
52 | public var cellTitleColor: UIColor = kActionSheetTextColor {
53 | didSet {
54 | reloadActionSheet()
55 | }
56 | }
57 | public var footerTitleColor: UIColor = kActionSheetTextColor {
58 | didSet {
59 | reloadActionSheet()
60 | }
61 | }
62 | /// 取消按钮的title,默认为取消
63 | public var footerTitle: String? {
64 | didSet {
65 | reloadActionSheet()
66 | }
67 | }
68 | /// 标题按钮的title
69 | public var headerTitle: String? {
70 | didSet {
71 | reloadActionSheet()
72 | }
73 | }
74 | /// actionSheet的标题集合
75 | public var moreButtonTitles: [String] = [] {
76 | didSet {
77 | reloadActionSheet()
78 | }
79 | }
80 |
81 | override public func viewDidLoad() {
82 | super.viewDidLoad()
83 |
84 | // Do any additional setup after loading the view.
85 | self.setView()
86 | }
87 |
88 | override public func didReceiveMemoryWarning() {
89 | super.didReceiveMemoryWarning()
90 | // Dispose of any resources that can be recreated.
91 | }
92 |
93 | func setView() {
94 | self.view.backgroundColor = UIColor(red: 0/255.0, green: 0/255.0, blue: 0/255.0, alpha: 0.6)
95 | self.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
96 | self.transitioningDelegate = self
97 | }
98 |
99 | /*!
100 | 计算actionSheet高度
101 |
102 | @discussion 大于屏幕高度减去状态栏高度时让table高度等于屏幕高度
103 | */
104 | func reloadActionSheet() {
105 | var height: CGFloat = 0
106 | height = height + (headerTitle != nil ? kActionSheetCellHeight : 0)
107 | height = height + (footerTitle != nil ? kActionSheetCellHeight + 3 : 0)
108 | height = height + kActionSheetCellHeight*CGFloat(moreButtonTitles.count)
109 | let maxHeight: CGFloat = (UIScreen.main.bounds.height == 812) ? (UIScreen.main.bounds.height - 44) : (UIScreen.main.bounds.height - 20)
110 | // 适配一下iphoneX
111 | if UIScreen.main.bounds.height == 812 {
112 | height += 83 - 49
113 | }
114 | if height > maxHeight {
115 | height = maxHeight
116 | }
117 | actionSheet.bounds = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: height)
118 | actionSheet.center = CGPoint(x: UIScreen.main.bounds.width*0.5, y: UIScreen.main.bounds.height-actionSheet.bounds.height*0.5)
119 | actionSheet.reloadData()
120 | }
121 |
122 | override public func touchesBegan(_ touches: Set, with event: UIEvent?) {
123 | self.dismiss(animated: true, completion: nil)
124 | }
125 |
126 | @objc private func hide() {
127 | self.dismiss(animated: true, completion: nil)
128 | }
129 |
130 | }
131 |
132 | extension DVActionSheetVC: UITableViewDelegate, UITableViewDataSource {
133 | public func numberOfSections(in tableView: UITableView) -> Int {
134 | return 1
135 | }
136 |
137 | public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
138 | return moreButtonTitles.count
139 | }
140 |
141 | public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
142 | return headerTitle != nil ? kActionSheetCellHeight : 0
143 | }
144 |
145 | public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
146 | return kActionSheetCellHeight
147 | }
148 |
149 | public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
150 | return footerTitle != nil ? (kActionSheetCellHeight + 3) : 0
151 | }
152 |
153 | public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
154 | if headerTitle != nil {
155 | let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: "DVActionHeader") as! DVActionHeader
156 | header.titleColor = headerTitleColor
157 | header.title = headerTitle
158 | return header
159 | }
160 | return nil
161 | }
162 |
163 | public func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
164 | if footerTitle != nil {
165 | let footer = tableView.dequeueReusableHeaderFooterView(withIdentifier: "DVActionFooter") as! DVActionFooter
166 | footer.titleColor = footerTitleColor
167 | footer.title = footerTitle
168 | footer.label.addTarget(self, action: #selector(self.hide), for:UIControl.Event.touchUpInside)
169 | return footer
170 | }
171 | return nil
172 | }
173 |
174 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
175 | let cell = tableView.dequeueReusableCell(withIdentifier: "DVActionCell") as! DVActionCell
176 | cell.titleColor = cellTitleColor
177 | cell.title = moreButtonTitles[indexPath.row]
178 | return cell
179 | }
180 |
181 | public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
182 | self.dismiss(animated: true) {
183 | if self.finishSelect != nil {
184 | self.finishSelect?(indexPath.row)
185 | } else {
186 | self.delegate?.dvActionSheetVC(self, clickedButtonAt: indexPath.row)
187 | }
188 | }
189 | }
190 | }
191 |
192 | /// 转场动画类型
193 | enum DVPresentAnimatorType {
194 | case present
195 | case dismiss
196 | }
197 |
198 | ///转场动画代理
199 | extension DVActionSheetVC: UIViewControllerTransitioningDelegate {
200 | public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
201 | return actionSheetVCPresentAnimator(withType: DVPresentAnimatorType.present)
202 | }
203 |
204 | public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
205 | return actionSheetVCPresentAnimator(withType: DVPresentAnimatorType.dismiss)
206 | }
207 | }
208 |
209 | /// 模态转场动画
210 | class actionSheetVCPresentAnimator: NSObject, UIViewControllerAnimatedTransitioning {
211 |
212 | var type: DVPresentAnimatorType = DVPresentAnimatorType.present
213 |
214 | init(withType: DVPresentAnimatorType) {
215 | super.init()
216 | self.type = withType
217 | }
218 |
219 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
220 | return 0.25
221 | }
222 |
223 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
224 | switch type {
225 | case DVPresentAnimatorType.present:
226 | self.presentAnimation(transitionContext: transitionContext)
227 | case DVPresentAnimatorType.dismiss:
228 | self.dismissAnimation(transitionContext: transitionContext)
229 | }
230 | }
231 |
232 | //present动画
233 | func presentAnimation(transitionContext: UIViewControllerContextTransitioning) {
234 | let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to) as? DVActionSheetVC
235 | let toView = transitionContext.view(forKey: UITransitionContextViewKey.to)
236 | //containerView是动画过程中提供的暂时容器。
237 | let containerView = transitionContext.containerView
238 | if toView != nil {
239 | containerView.addSubview(toView!)
240 | toView!.backgroundColor = UIColor.black.withAlphaComponent(0)
241 | let transitionDuration = self.transitionDuration(using: transitionContext)
242 | let actionSheet = toVC?.actionSheet
243 | let transform = CGAffineTransform(translationX: 0, y: actionSheet?.bounds.height ?? 0)
244 | actionSheet?.transform = transform
245 | toView?.backgroundColor = UIColor.black.withAlphaComponent(0)
246 | UIView.animate(withDuration: transitionDuration, animations: {
247 | toView?.backgroundColor = UIColor.black.withAlphaComponent(0.6)
248 | actionSheet?.transform = CGAffineTransform.identity
249 | }, completion: { (bool) in
250 | let wasCancelled = transitionContext.transitionWasCancelled
251 | transitionContext.completeTransition(!wasCancelled)
252 | })
253 | }
254 | }
255 |
256 | //dismiss动画
257 | func dismissAnimation(transitionContext: UIViewControllerContextTransitioning) {
258 | let fromView = transitionContext.view(forKey: UITransitionContextViewKey.from)
259 | let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from) as? DVActionSheetVC
260 | if fromView != nil {
261 | let actionSheet = fromVC?.actionSheet
262 | let transitionDuration = self.transitionDuration(using: transitionContext)
263 | UIView.animate(withDuration: transitionDuration, animations: {
264 | let transform = CGAffineTransform(translationX: actionSheet?.transform.tx ?? 0, y: actionSheet?.bounds.height ?? 0)
265 | actionSheet?.transform = transform
266 | fromView?.backgroundColor = UIColor.black.withAlphaComponent(0)
267 | }, completion: { (bool) in
268 | let wasCancelled = transitionContext.transitionWasCancelled
269 | transitionContext.completeTransition(!wasCancelled)
270 | })
271 | }
272 | }
273 |
274 | }
275 |
276 | /*!
277 | ActionSheet的Cell
278 |
279 | @discussion 用来显示各类选项
280 | */
281 | class DVActionCell: UITableViewCell {
282 | var title: String? {
283 | didSet {
284 | self.label.text = title
285 | }
286 | }
287 | var titleColor: UIColor? {
288 | didSet {
289 | label.textColor = titleColor
290 | }
291 | }
292 | var label = UILabel()
293 |
294 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
295 | super.init(style: style, reuseIdentifier: reuseIdentifier)
296 | self.contentView.backgroundColor = UIColor.white
297 | label.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kActionSheetCellHeight)
298 | label.backgroundColor = UIColor.white
299 | label.font = UIFont.systemFont(ofSize: 17)
300 | label.textAlignment = NSTextAlignment.center
301 | label.adjustsFontSizeToFitWidth = true
302 | self.contentView.addSubview(label)
303 |
304 | let subLayer = CAShapeLayer()
305 | subLayer.strokeColor = UIColor(red: 224/255.0, green: 224/255.0, blue: 224/255.0, alpha: 1).cgColor
306 | subLayer.lineWidth = (1 / UIScreen.main.scale)
307 | let path = UIBezierPath()
308 | path.move(to: CGPoint(x: 0-((1 / UIScreen.main.scale) / 2), y: kActionSheetCellHeight))
309 | path.addLine(to: CGPoint(x: UIScreen.main.bounds.width-((1 / UIScreen.main.scale) / 2), y: kActionSheetCellHeight))
310 | subLayer.path = path.cgPath
311 | self.contentView.layer.addSublayer(subLayer)
312 |
313 | self.selectedBackgroundView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kActionSheetCellHeight))
314 | self.selectedBackgroundView?.backgroundColor = UIColor(red: 245/255.0, green: 245/255.0, blue: 245/255.0, alpha: 0.9)
315 | }
316 |
317 | required init?(coder aDecoder: NSCoder) {
318 | fatalError("init(coder:) has not been implemented")
319 | }
320 |
321 | }
322 |
323 | /*!
324 | ActionSheet的Header
325 |
326 | @discussion 用来显示标题之类
327 | */
328 | class DVActionHeader: UITableViewHeaderFooterView {
329 | var title: String? {
330 | didSet {
331 | label.text = title
332 | }
333 | }
334 | var titleColor: UIColor? {
335 | didSet {
336 | label.textColor = titleColor
337 | }
338 | }
339 | var label = UILabel()
340 | override init(reuseIdentifier: String?) {
341 | super.init(reuseIdentifier: reuseIdentifier)
342 | self.contentView.backgroundColor = UIColor.white
343 |
344 | label = UILabel(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kActionSheetCellHeight))
345 | label.backgroundColor = UIColor.white
346 | label.font = UIFont.systemFont(ofSize: 14)
347 | label.textAlignment = NSTextAlignment.center
348 | self.contentView.addSubview(label)
349 |
350 | let subLayer = CAShapeLayer()
351 | subLayer.strokeColor = UIColor(red: 224/255.0, green: 224/255.0, blue: 224/255.0, alpha: 1).cgColor
352 | subLayer.lineWidth = (1 / UIScreen.main.scale)
353 | let path = UIBezierPath()
354 | path.move(to: CGPoint(x: 0-((1 / UIScreen.main.scale) / 2), y: kActionSheetCellHeight))
355 | path.addLine(to: CGPoint(x: UIScreen.main.bounds.width-((1 / UIScreen.main.scale) / 2), y: kActionSheetCellHeight))
356 | subLayer.path = path.cgPath
357 | self.contentView.layer.addSublayer(subLayer)
358 | }
359 |
360 | required init?(coder aDecoder: NSCoder) {
361 | fatalError("init(coder:) has not been implemented")
362 | }
363 | }
364 |
365 | /*!
366 | ActionSheet的Footer
367 |
368 | @discussion 用来显示取消之类的操作
369 | */
370 | class DVActionFooter: UITableViewHeaderFooterView {
371 | var title: String? {
372 | didSet {
373 | label.setTitle(title, for: UIControl.State.normal)
374 | }
375 | }
376 | var titleColor: UIColor? {
377 | didSet {
378 | label.setTitleColor(titleColor, for: UIControl.State.normal)
379 | }
380 | }
381 | var label = UIButton()
382 | override init(reuseIdentifier: String?) {
383 | super.init(reuseIdentifier: reuseIdentifier)
384 | self.contentView.backgroundColor = UIColor.white
385 |
386 | let subLayer = CALayer()
387 | subLayer.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 3)
388 | subLayer.backgroundColor = UIColor(red: 231/255.0, green: 231/255.0, blue: 231/255.0, alpha: 0.9).cgColor
389 | self.contentView.layer.addSublayer(subLayer)
390 |
391 | label.frame = CGRect(x: 0, y: 3, width: UIScreen.main.bounds.width, height: kActionSheetCellHeight)
392 | label.backgroundColor = UIColor.white
393 | label.setBackgroundImage(UIImage.ImageFromColor(UIColor(red: 245/255.0, green: 245/255.0, blue: 245/255.0, alpha: 0.9), frame: label.bounds), for: UIControl.State.highlighted)
394 | label.titleLabel?.font = UIFont.systemFont(ofSize: 17)
395 | label.titleLabel?.textAlignment = NSTextAlignment.center
396 | self.contentView.addSubview(label)
397 | }
398 |
399 | required init?(coder aDecoder: NSCoder) {
400 | fatalError("init(coder:) has not been implemented")
401 | }
402 | }
403 |
404 | extension UIImage {
405 | /*!
406 | 通过颜色来生成图片
407 |
408 | @discussion
409 | */
410 | static func ImageFromColor(_ color: UIColor, frame: CGRect) -> UIImage {
411 | let rect = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
412 | UIGraphicsBeginImageContext(rect.size)
413 | let context = UIGraphicsGetCurrentContext()
414 | context?.setFillColor(color.cgColor)
415 | context?.fill(rect)
416 | let img = UIGraphicsGetImageFromCurrentImageContext()
417 | UIGraphicsEndImageContext()
418 | return img!
419 | }
420 | }
421 |
--------------------------------------------------------------------------------
/DVActionSheetDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4B6EB1C61F53B0D4005BADFE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EB1C51F53B0D4005BADFE /* AppDelegate.swift */; };
11 | 4B6EB1C81F53B0D4005BADFE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EB1C71F53B0D4005BADFE /* ViewController.swift */; };
12 | 4B6EB1CB1F53B0D4005BADFE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B6EB1C91F53B0D4005BADFE /* Main.storyboard */; };
13 | 4B6EB1CD1F53B0D4005BADFE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B6EB1CC1F53B0D4005BADFE /* Assets.xcassets */; };
14 | 4B6EB1D01F53B0D4005BADFE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B6EB1CE1F53B0D4005BADFE /* LaunchScreen.storyboard */; };
15 | 4B6EB1DB1F53B0D4005BADFE /* DVActionSheetDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EB1DA1F53B0D4005BADFE /* DVActionSheetDemoTests.swift */; };
16 | 4B6EB1E61F53B0D4005BADFE /* DVActionSheetDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EB1E51F53B0D4005BADFE /* DVActionSheetDemoUITests.swift */; };
17 | 4B6EB1F41F53B133005BADFE /* DVActionSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EB1F31F53B133005BADFE /* DVActionSheetVC.swift */; };
18 | 4B6EB1F91F53F5FC005BADFE /* IMG_1625.PNG in Resources */ = {isa = PBXBuildFile; fileRef = 4B6EB1F81F53F5FC005BADFE /* IMG_1625.PNG */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | 4B6EB1D71F53B0D4005BADFE /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = 4B6EB1BA1F53B0D4005BADFE /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = 4B6EB1C11F53B0D4005BADFE;
27 | remoteInfo = DVActionSheetDemo;
28 | };
29 | 4B6EB1E21F53B0D4005BADFE /* PBXContainerItemProxy */ = {
30 | isa = PBXContainerItemProxy;
31 | containerPortal = 4B6EB1BA1F53B0D4005BADFE /* Project object */;
32 | proxyType = 1;
33 | remoteGlobalIDString = 4B6EB1C11F53B0D4005BADFE;
34 | remoteInfo = DVActionSheetDemo;
35 | };
36 | /* End PBXContainerItemProxy section */
37 |
38 | /* Begin PBXFileReference section */
39 | 4B6EB1C21F53B0D4005BADFE /* DVActionSheetDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DVActionSheetDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
40 | 4B6EB1C51F53B0D4005BADFE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
41 | 4B6EB1C71F53B0D4005BADFE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
42 | 4B6EB1CA1F53B0D4005BADFE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
43 | 4B6EB1CC1F53B0D4005BADFE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
44 | 4B6EB1CF1F53B0D4005BADFE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
45 | 4B6EB1D11F53B0D4005BADFE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
46 | 4B6EB1D61F53B0D4005BADFE /* DVActionSheetDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DVActionSheetDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
47 | 4B6EB1DA1F53B0D4005BADFE /* DVActionSheetDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DVActionSheetDemoTests.swift; sourceTree = ""; };
48 | 4B6EB1DC1F53B0D4005BADFE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 4B6EB1E11F53B0D4005BADFE /* DVActionSheetDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DVActionSheetDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
50 | 4B6EB1E51F53B0D4005BADFE /* DVActionSheetDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DVActionSheetDemoUITests.swift; sourceTree = ""; };
51 | 4B6EB1E71F53B0D4005BADFE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
52 | 4B6EB1F31F53B133005BADFE /* DVActionSheetVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DVActionSheetVC.swift; sourceTree = ""; };
53 | 4B6EB1F81F53F5FC005BADFE /* IMG_1625.PNG */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = IMG_1625.PNG; sourceTree = ""; };
54 | /* End PBXFileReference section */
55 |
56 | /* Begin PBXFrameworksBuildPhase section */
57 | 4B6EB1BF1F53B0D4005BADFE /* Frameworks */ = {
58 | isa = PBXFrameworksBuildPhase;
59 | buildActionMask = 2147483647;
60 | files = (
61 | );
62 | runOnlyForDeploymentPostprocessing = 0;
63 | };
64 | 4B6EB1D31F53B0D4005BADFE /* Frameworks */ = {
65 | isa = PBXFrameworksBuildPhase;
66 | buildActionMask = 2147483647;
67 | files = (
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | 4B6EB1DE1F53B0D4005BADFE /* Frameworks */ = {
72 | isa = PBXFrameworksBuildPhase;
73 | buildActionMask = 2147483647;
74 | files = (
75 | );
76 | runOnlyForDeploymentPostprocessing = 0;
77 | };
78 | /* End PBXFrameworksBuildPhase section */
79 |
80 | /* Begin PBXGroup section */
81 | 4B6EB1B91F53B0D4005BADFE = {
82 | isa = PBXGroup;
83 | children = (
84 | 4B6EB1C41F53B0D4005BADFE /* DVActionSheetDemo */,
85 | 4B6EB1D91F53B0D4005BADFE /* DVActionSheetDemoTests */,
86 | 4B6EB1E41F53B0D4005BADFE /* DVActionSheetDemoUITests */,
87 | 4B6EB1C31F53B0D4005BADFE /* Products */,
88 | );
89 | sourceTree = "";
90 | };
91 | 4B6EB1C31F53B0D4005BADFE /* Products */ = {
92 | isa = PBXGroup;
93 | children = (
94 | 4B6EB1C21F53B0D4005BADFE /* DVActionSheetDemo.app */,
95 | 4B6EB1D61F53B0D4005BADFE /* DVActionSheetDemoTests.xctest */,
96 | 4B6EB1E11F53B0D4005BADFE /* DVActionSheetDemoUITests.xctest */,
97 | );
98 | name = Products;
99 | sourceTree = "";
100 | };
101 | 4B6EB1C41F53B0D4005BADFE /* DVActionSheetDemo */ = {
102 | isa = PBXGroup;
103 | children = (
104 | 4B6EB1C51F53B0D4005BADFE /* AppDelegate.swift */,
105 | 4B6EB1C71F53B0D4005BADFE /* ViewController.swift */,
106 | 4B6EB1F31F53B133005BADFE /* DVActionSheetVC.swift */,
107 | 4B6EB1C91F53B0D4005BADFE /* Main.storyboard */,
108 | 4B6EB1CC1F53B0D4005BADFE /* Assets.xcassets */,
109 | 4B6EB1CE1F53B0D4005BADFE /* LaunchScreen.storyboard */,
110 | 4B6EB1D11F53B0D4005BADFE /* Info.plist */,
111 | 4B6EB1F71F53F5FC005BADFE /* ScreenShots */,
112 | );
113 | path = DVActionSheetDemo;
114 | sourceTree = "";
115 | };
116 | 4B6EB1D91F53B0D4005BADFE /* DVActionSheetDemoTests */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 4B6EB1DA1F53B0D4005BADFE /* DVActionSheetDemoTests.swift */,
120 | 4B6EB1DC1F53B0D4005BADFE /* Info.plist */,
121 | );
122 | path = DVActionSheetDemoTests;
123 | sourceTree = "";
124 | };
125 | 4B6EB1E41F53B0D4005BADFE /* DVActionSheetDemoUITests */ = {
126 | isa = PBXGroup;
127 | children = (
128 | 4B6EB1E51F53B0D4005BADFE /* DVActionSheetDemoUITests.swift */,
129 | 4B6EB1E71F53B0D4005BADFE /* Info.plist */,
130 | );
131 | path = DVActionSheetDemoUITests;
132 | sourceTree = "";
133 | };
134 | 4B6EB1F71F53F5FC005BADFE /* ScreenShots */ = {
135 | isa = PBXGroup;
136 | children = (
137 | 4B6EB1F81F53F5FC005BADFE /* IMG_1625.PNG */,
138 | );
139 | path = ScreenShots;
140 | sourceTree = "";
141 | };
142 | /* End PBXGroup section */
143 |
144 | /* Begin PBXNativeTarget section */
145 | 4B6EB1C11F53B0D4005BADFE /* DVActionSheetDemo */ = {
146 | isa = PBXNativeTarget;
147 | buildConfigurationList = 4B6EB1EA1F53B0D4005BADFE /* Build configuration list for PBXNativeTarget "DVActionSheetDemo" */;
148 | buildPhases = (
149 | 4B6EB1BE1F53B0D4005BADFE /* Sources */,
150 | 4B6EB1BF1F53B0D4005BADFE /* Frameworks */,
151 | 4B6EB1C01F53B0D4005BADFE /* Resources */,
152 | );
153 | buildRules = (
154 | );
155 | dependencies = (
156 | );
157 | name = DVActionSheetDemo;
158 | productName = DVActionSheetDemo;
159 | productReference = 4B6EB1C21F53B0D4005BADFE /* DVActionSheetDemo.app */;
160 | productType = "com.apple.product-type.application";
161 | };
162 | 4B6EB1D51F53B0D4005BADFE /* DVActionSheetDemoTests */ = {
163 | isa = PBXNativeTarget;
164 | buildConfigurationList = 4B6EB1ED1F53B0D4005BADFE /* Build configuration list for PBXNativeTarget "DVActionSheetDemoTests" */;
165 | buildPhases = (
166 | 4B6EB1D21F53B0D4005BADFE /* Sources */,
167 | 4B6EB1D31F53B0D4005BADFE /* Frameworks */,
168 | 4B6EB1D41F53B0D4005BADFE /* Resources */,
169 | );
170 | buildRules = (
171 | );
172 | dependencies = (
173 | 4B6EB1D81F53B0D4005BADFE /* PBXTargetDependency */,
174 | );
175 | name = DVActionSheetDemoTests;
176 | productName = DVActionSheetDemoTests;
177 | productReference = 4B6EB1D61F53B0D4005BADFE /* DVActionSheetDemoTests.xctest */;
178 | productType = "com.apple.product-type.bundle.unit-test";
179 | };
180 | 4B6EB1E01F53B0D4005BADFE /* DVActionSheetDemoUITests */ = {
181 | isa = PBXNativeTarget;
182 | buildConfigurationList = 4B6EB1F01F53B0D4005BADFE /* Build configuration list for PBXNativeTarget "DVActionSheetDemoUITests" */;
183 | buildPhases = (
184 | 4B6EB1DD1F53B0D4005BADFE /* Sources */,
185 | 4B6EB1DE1F53B0D4005BADFE /* Frameworks */,
186 | 4B6EB1DF1F53B0D4005BADFE /* Resources */,
187 | );
188 | buildRules = (
189 | );
190 | dependencies = (
191 | 4B6EB1E31F53B0D4005BADFE /* PBXTargetDependency */,
192 | );
193 | name = DVActionSheetDemoUITests;
194 | productName = DVActionSheetDemoUITests;
195 | productReference = 4B6EB1E11F53B0D4005BADFE /* DVActionSheetDemoUITests.xctest */;
196 | productType = "com.apple.product-type.bundle.ui-testing";
197 | };
198 | /* End PBXNativeTarget section */
199 |
200 | /* Begin PBXProject section */
201 | 4B6EB1BA1F53B0D4005BADFE /* Project object */ = {
202 | isa = PBXProject;
203 | attributes = {
204 | LastSwiftUpdateCheck = 0830;
205 | LastUpgradeCheck = 0920;
206 | ORGANIZATIONNAME = david;
207 | TargetAttributes = {
208 | 4B6EB1C11F53B0D4005BADFE = {
209 | CreatedOnToolsVersion = 8.3.3;
210 | DevelopmentTeam = W44VGDHSN2;
211 | LastSwiftMigration = 0920;
212 | ProvisioningStyle = Automatic;
213 | };
214 | 4B6EB1D51F53B0D4005BADFE = {
215 | CreatedOnToolsVersion = 8.3.3;
216 | DevelopmentTeam = D8Q225Y964;
217 | LastSwiftMigration = 0920;
218 | ProvisioningStyle = Automatic;
219 | TestTargetID = 4B6EB1C11F53B0D4005BADFE;
220 | };
221 | 4B6EB1E01F53B0D4005BADFE = {
222 | CreatedOnToolsVersion = 8.3.3;
223 | DevelopmentTeam = D8Q225Y964;
224 | LastSwiftMigration = 0920;
225 | ProvisioningStyle = Automatic;
226 | TestTargetID = 4B6EB1C11F53B0D4005BADFE;
227 | };
228 | };
229 | };
230 | buildConfigurationList = 4B6EB1BD1F53B0D4005BADFE /* Build configuration list for PBXProject "DVActionSheetDemo" */;
231 | compatibilityVersion = "Xcode 3.2";
232 | developmentRegion = English;
233 | hasScannedForEncodings = 0;
234 | knownRegions = (
235 | en,
236 | Base,
237 | );
238 | mainGroup = 4B6EB1B91F53B0D4005BADFE;
239 | productRefGroup = 4B6EB1C31F53B0D4005BADFE /* Products */;
240 | projectDirPath = "";
241 | projectRoot = "";
242 | targets = (
243 | 4B6EB1C11F53B0D4005BADFE /* DVActionSheetDemo */,
244 | 4B6EB1D51F53B0D4005BADFE /* DVActionSheetDemoTests */,
245 | 4B6EB1E01F53B0D4005BADFE /* DVActionSheetDemoUITests */,
246 | );
247 | };
248 | /* End PBXProject section */
249 |
250 | /* Begin PBXResourcesBuildPhase section */
251 | 4B6EB1C01F53B0D4005BADFE /* Resources */ = {
252 | isa = PBXResourcesBuildPhase;
253 | buildActionMask = 2147483647;
254 | files = (
255 | 4B6EB1D01F53B0D4005BADFE /* LaunchScreen.storyboard in Resources */,
256 | 4B6EB1F91F53F5FC005BADFE /* IMG_1625.PNG in Resources */,
257 | 4B6EB1CD1F53B0D4005BADFE /* Assets.xcassets in Resources */,
258 | 4B6EB1CB1F53B0D4005BADFE /* Main.storyboard in Resources */,
259 | );
260 | runOnlyForDeploymentPostprocessing = 0;
261 | };
262 | 4B6EB1D41F53B0D4005BADFE /* Resources */ = {
263 | isa = PBXResourcesBuildPhase;
264 | buildActionMask = 2147483647;
265 | files = (
266 | );
267 | runOnlyForDeploymentPostprocessing = 0;
268 | };
269 | 4B6EB1DF1F53B0D4005BADFE /* Resources */ = {
270 | isa = PBXResourcesBuildPhase;
271 | buildActionMask = 2147483647;
272 | files = (
273 | );
274 | runOnlyForDeploymentPostprocessing = 0;
275 | };
276 | /* End PBXResourcesBuildPhase section */
277 |
278 | /* Begin PBXSourcesBuildPhase section */
279 | 4B6EB1BE1F53B0D4005BADFE /* Sources */ = {
280 | isa = PBXSourcesBuildPhase;
281 | buildActionMask = 2147483647;
282 | files = (
283 | 4B6EB1C81F53B0D4005BADFE /* ViewController.swift in Sources */,
284 | 4B6EB1F41F53B133005BADFE /* DVActionSheetVC.swift in Sources */,
285 | 4B6EB1C61F53B0D4005BADFE /* AppDelegate.swift in Sources */,
286 | );
287 | runOnlyForDeploymentPostprocessing = 0;
288 | };
289 | 4B6EB1D21F53B0D4005BADFE /* Sources */ = {
290 | isa = PBXSourcesBuildPhase;
291 | buildActionMask = 2147483647;
292 | files = (
293 | 4B6EB1DB1F53B0D4005BADFE /* DVActionSheetDemoTests.swift in Sources */,
294 | );
295 | runOnlyForDeploymentPostprocessing = 0;
296 | };
297 | 4B6EB1DD1F53B0D4005BADFE /* Sources */ = {
298 | isa = PBXSourcesBuildPhase;
299 | buildActionMask = 2147483647;
300 | files = (
301 | 4B6EB1E61F53B0D4005BADFE /* DVActionSheetDemoUITests.swift in Sources */,
302 | );
303 | runOnlyForDeploymentPostprocessing = 0;
304 | };
305 | /* End PBXSourcesBuildPhase section */
306 |
307 | /* Begin PBXTargetDependency section */
308 | 4B6EB1D81F53B0D4005BADFE /* PBXTargetDependency */ = {
309 | isa = PBXTargetDependency;
310 | target = 4B6EB1C11F53B0D4005BADFE /* DVActionSheetDemo */;
311 | targetProxy = 4B6EB1D71F53B0D4005BADFE /* PBXContainerItemProxy */;
312 | };
313 | 4B6EB1E31F53B0D4005BADFE /* PBXTargetDependency */ = {
314 | isa = PBXTargetDependency;
315 | target = 4B6EB1C11F53B0D4005BADFE /* DVActionSheetDemo */;
316 | targetProxy = 4B6EB1E21F53B0D4005BADFE /* PBXContainerItemProxy */;
317 | };
318 | /* End PBXTargetDependency section */
319 |
320 | /* Begin PBXVariantGroup section */
321 | 4B6EB1C91F53B0D4005BADFE /* Main.storyboard */ = {
322 | isa = PBXVariantGroup;
323 | children = (
324 | 4B6EB1CA1F53B0D4005BADFE /* Base */,
325 | );
326 | name = Main.storyboard;
327 | sourceTree = "";
328 | };
329 | 4B6EB1CE1F53B0D4005BADFE /* LaunchScreen.storyboard */ = {
330 | isa = PBXVariantGroup;
331 | children = (
332 | 4B6EB1CF1F53B0D4005BADFE /* Base */,
333 | );
334 | name = LaunchScreen.storyboard;
335 | sourceTree = "";
336 | };
337 | /* End PBXVariantGroup section */
338 |
339 | /* Begin XCBuildConfiguration section */
340 | 4B6EB1E81F53B0D4005BADFE /* Debug */ = {
341 | isa = XCBuildConfiguration;
342 | buildSettings = {
343 | ALWAYS_SEARCH_USER_PATHS = NO;
344 | CLANG_ANALYZER_NONNULL = YES;
345 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
346 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
347 | CLANG_CXX_LIBRARY = "libc++";
348 | CLANG_ENABLE_MODULES = YES;
349 | CLANG_ENABLE_OBJC_ARC = YES;
350 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
351 | CLANG_WARN_BOOL_CONVERSION = YES;
352 | CLANG_WARN_COMMA = YES;
353 | CLANG_WARN_CONSTANT_CONVERSION = YES;
354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
355 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
356 | CLANG_WARN_EMPTY_BODY = YES;
357 | CLANG_WARN_ENUM_CONVERSION = YES;
358 | CLANG_WARN_INFINITE_RECURSION = YES;
359 | CLANG_WARN_INT_CONVERSION = YES;
360 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
361 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
362 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
363 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
364 | CLANG_WARN_STRICT_PROTOTYPES = YES;
365 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
366 | CLANG_WARN_UNREACHABLE_CODE = YES;
367 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
368 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
369 | COPY_PHASE_STRIP = NO;
370 | DEBUG_INFORMATION_FORMAT = dwarf;
371 | ENABLE_STRICT_OBJC_MSGSEND = YES;
372 | ENABLE_TESTABILITY = YES;
373 | GCC_C_LANGUAGE_STANDARD = gnu99;
374 | GCC_DYNAMIC_NO_PIC = NO;
375 | GCC_NO_COMMON_BLOCKS = YES;
376 | GCC_OPTIMIZATION_LEVEL = 0;
377 | GCC_PREPROCESSOR_DEFINITIONS = (
378 | "DEBUG=1",
379 | "$(inherited)",
380 | );
381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
382 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
383 | GCC_WARN_UNDECLARED_SELECTOR = YES;
384 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
385 | GCC_WARN_UNUSED_FUNCTION = YES;
386 | GCC_WARN_UNUSED_VARIABLE = YES;
387 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
388 | MTL_ENABLE_DEBUG_INFO = YES;
389 | ONLY_ACTIVE_ARCH = YES;
390 | SDKROOT = iphoneos;
391 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
392 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
393 | };
394 | name = Debug;
395 | };
396 | 4B6EB1E91F53B0D4005BADFE /* Release */ = {
397 | isa = XCBuildConfiguration;
398 | buildSettings = {
399 | ALWAYS_SEARCH_USER_PATHS = NO;
400 | CLANG_ANALYZER_NONNULL = YES;
401 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
402 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
403 | CLANG_CXX_LIBRARY = "libc++";
404 | CLANG_ENABLE_MODULES = YES;
405 | CLANG_ENABLE_OBJC_ARC = YES;
406 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
407 | CLANG_WARN_BOOL_CONVERSION = YES;
408 | CLANG_WARN_COMMA = YES;
409 | CLANG_WARN_CONSTANT_CONVERSION = YES;
410 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
411 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
412 | CLANG_WARN_EMPTY_BODY = YES;
413 | CLANG_WARN_ENUM_CONVERSION = YES;
414 | CLANG_WARN_INFINITE_RECURSION = YES;
415 | CLANG_WARN_INT_CONVERSION = YES;
416 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
417 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
418 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
419 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
420 | CLANG_WARN_STRICT_PROTOTYPES = YES;
421 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
422 | CLANG_WARN_UNREACHABLE_CODE = YES;
423 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
424 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
425 | COPY_PHASE_STRIP = NO;
426 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
427 | ENABLE_NS_ASSERTIONS = NO;
428 | ENABLE_STRICT_OBJC_MSGSEND = YES;
429 | GCC_C_LANGUAGE_STANDARD = gnu99;
430 | GCC_NO_COMMON_BLOCKS = YES;
431 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
432 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
433 | GCC_WARN_UNDECLARED_SELECTOR = YES;
434 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
435 | GCC_WARN_UNUSED_FUNCTION = YES;
436 | GCC_WARN_UNUSED_VARIABLE = YES;
437 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
438 | MTL_ENABLE_DEBUG_INFO = NO;
439 | SDKROOT = iphoneos;
440 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
441 | VALIDATE_PRODUCT = YES;
442 | };
443 | name = Release;
444 | };
445 | 4B6EB1EB1F53B0D4005BADFE /* Debug */ = {
446 | isa = XCBuildConfiguration;
447 | buildSettings = {
448 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
449 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
450 | CODE_SIGN_STYLE = Automatic;
451 | DEVELOPMENT_TEAM = "";
452 | INFOPLIST_FILE = DVActionSheetDemo/Info.plist;
453 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
454 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
455 | PRODUCT_BUNDLE_IDENTIFIER = com.amall360.amalltest;
456 | PRODUCT_NAME = "$(TARGET_NAME)";
457 | PROVISIONING_PROFILE = "";
458 | PROVISIONING_PROFILE_SPECIFIER = "";
459 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
460 | SWIFT_VERSION = 4.0;
461 | };
462 | name = Debug;
463 | };
464 | 4B6EB1EC1F53B0D4005BADFE /* Release */ = {
465 | isa = XCBuildConfiguration;
466 | buildSettings = {
467 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
468 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
469 | CODE_SIGN_STYLE = Automatic;
470 | DEVELOPMENT_TEAM = "";
471 | INFOPLIST_FILE = DVActionSheetDemo/Info.plist;
472 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
474 | PRODUCT_BUNDLE_IDENTIFIER = com.amall360.amalltest;
475 | PRODUCT_NAME = "$(TARGET_NAME)";
476 | PROVISIONING_PROFILE_SPECIFIER = "";
477 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
478 | SWIFT_VERSION = 4.0;
479 | };
480 | name = Release;
481 | };
482 | 4B6EB1EE1F53B0D4005BADFE /* Debug */ = {
483 | isa = XCBuildConfiguration;
484 | buildSettings = {
485 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
486 | BUNDLE_LOADER = "$(TEST_HOST)";
487 | DEVELOPMENT_TEAM = D8Q225Y964;
488 | INFOPLIST_FILE = DVActionSheetDemoTests/Info.plist;
489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
490 | PRODUCT_BUNDLE_IDENTIFIER = com.amall360.amalltest.DVActionSheetDemoTests;
491 | PRODUCT_NAME = "$(TARGET_NAME)";
492 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
493 | SWIFT_VERSION = 4.0;
494 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DVActionSheetDemo.app/DVActionSheetDemo";
495 | };
496 | name = Debug;
497 | };
498 | 4B6EB1EF1F53B0D4005BADFE /* Release */ = {
499 | isa = XCBuildConfiguration;
500 | buildSettings = {
501 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
502 | BUNDLE_LOADER = "$(TEST_HOST)";
503 | DEVELOPMENT_TEAM = D8Q225Y964;
504 | INFOPLIST_FILE = DVActionSheetDemoTests/Info.plist;
505 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
506 | PRODUCT_BUNDLE_IDENTIFIER = com.amall360.amalltest.DVActionSheetDemoTests;
507 | PRODUCT_NAME = "$(TARGET_NAME)";
508 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
509 | SWIFT_VERSION = 4.0;
510 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DVActionSheetDemo.app/DVActionSheetDemo";
511 | };
512 | name = Release;
513 | };
514 | 4B6EB1F11F53B0D4005BADFE /* Debug */ = {
515 | isa = XCBuildConfiguration;
516 | buildSettings = {
517 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
518 | DEVELOPMENT_TEAM = D8Q225Y964;
519 | INFOPLIST_FILE = DVActionSheetDemoUITests/Info.plist;
520 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
521 | PRODUCT_BUNDLE_IDENTIFIER = com.amall360.amalltest.DVActionSheetDemoUITests;
522 | PRODUCT_NAME = "$(TARGET_NAME)";
523 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
524 | SWIFT_VERSION = 4.0;
525 | TEST_TARGET_NAME = DVActionSheetDemo;
526 | };
527 | name = Debug;
528 | };
529 | 4B6EB1F21F53B0D4005BADFE /* Release */ = {
530 | isa = XCBuildConfiguration;
531 | buildSettings = {
532 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
533 | DEVELOPMENT_TEAM = D8Q225Y964;
534 | INFOPLIST_FILE = DVActionSheetDemoUITests/Info.plist;
535 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
536 | PRODUCT_BUNDLE_IDENTIFIER = com.amall360.amalltest.DVActionSheetDemoUITests;
537 | PRODUCT_NAME = "$(TARGET_NAME)";
538 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
539 | SWIFT_VERSION = 4.0;
540 | TEST_TARGET_NAME = DVActionSheetDemo;
541 | };
542 | name = Release;
543 | };
544 | /* End XCBuildConfiguration section */
545 |
546 | /* Begin XCConfigurationList section */
547 | 4B6EB1BD1F53B0D4005BADFE /* Build configuration list for PBXProject "DVActionSheetDemo" */ = {
548 | isa = XCConfigurationList;
549 | buildConfigurations = (
550 | 4B6EB1E81F53B0D4005BADFE /* Debug */,
551 | 4B6EB1E91F53B0D4005BADFE /* Release */,
552 | );
553 | defaultConfigurationIsVisible = 0;
554 | defaultConfigurationName = Release;
555 | };
556 | 4B6EB1EA1F53B0D4005BADFE /* Build configuration list for PBXNativeTarget "DVActionSheetDemo" */ = {
557 | isa = XCConfigurationList;
558 | buildConfigurations = (
559 | 4B6EB1EB1F53B0D4005BADFE /* Debug */,
560 | 4B6EB1EC1F53B0D4005BADFE /* Release */,
561 | );
562 | defaultConfigurationIsVisible = 0;
563 | defaultConfigurationName = Release;
564 | };
565 | 4B6EB1ED1F53B0D4005BADFE /* Build configuration list for PBXNativeTarget "DVActionSheetDemoTests" */ = {
566 | isa = XCConfigurationList;
567 | buildConfigurations = (
568 | 4B6EB1EE1F53B0D4005BADFE /* Debug */,
569 | 4B6EB1EF1F53B0D4005BADFE /* Release */,
570 | );
571 | defaultConfigurationIsVisible = 0;
572 | defaultConfigurationName = Release;
573 | };
574 | 4B6EB1F01F53B0D4005BADFE /* Build configuration list for PBXNativeTarget "DVActionSheetDemoUITests" */ = {
575 | isa = XCConfigurationList;
576 | buildConfigurations = (
577 | 4B6EB1F11F53B0D4005BADFE /* Debug */,
578 | 4B6EB1F21F53B0D4005BADFE /* Release */,
579 | );
580 | defaultConfigurationIsVisible = 0;
581 | defaultConfigurationName = Release;
582 | };
583 | /* End XCConfigurationList section */
584 | };
585 | rootObject = 4B6EB1BA1F53B0D4005BADFE /* Project object */;
586 | }
587 |
--------------------------------------------------------------------------------