这个库是 tabletview 对 ActionSheet 的一个扩展。
有两种方式可以在项目中使用它:
将KkListActionSheet-Swift目录复制到您的项目中
使用CocoaPods安装,编写Podfile
pratform :ios
target 'yourtarget' do
pod 'KkListActionSheetSwift'
end
target 'yourtargetTests' do
pod 'KkListActionSheetSwift'
end
KkListActionSheet-Swift使用简单的方法。导入头文件,它定义了一个委托(包含数据源),客户实现。KkListActionSheetDelegate类似于combined UITableViewDelegate和UITableViewDatasource。
yourViewController.swift
class ViewController: UIViewController, KkListActionSheetDelegate {...}
public class func createInit(parent: UIViewController) -> KkListActionSheet
或者
public class func createInit(parent: UIViewController, style styleIdx:HIGHSTYLE) -> KkListActionSheet
纵向模式下的样式
横向模式下的样式
kkListActionSheet.showHide()
public func setHiddenTitle ()
kkListActionSheet.setTitle("titleString")
或者
var attrTitle = NSMutableAttributedString("titleString")
…
kkListActionSheet.setAttrTitle(attrTitle)
import kkListActionSheetSwift
class yourViewController: UIViewController, kkListActionSheetDelegate {
var kkListActionSheet: kkListActionSheet?
override func viewDidLoad {
super.viewDidLoad()
kkListActionSheet = KkListActionSheet.createInit(self)
kkListActionSheet!.delegate = self
}
@IBAction func buttonPushed (button: UIButton) {
kkListActionSheet.showHide()
}
}