SCPromptView
SCPromptView: 顯示在頂部的提示控件
OC版
你的star是我最大的動(dòng)力

effect.gif
安裝
手動(dòng)安裝
下載源碼,將SCPromptView文件夾拖進(jìn)項(xiàng)目
CocoaPod
pod 'SCPromptView'
使用
SCPromptView 的用法,與tableView相似
創(chuàng)建view
class TestView: SCPromptView {
var label:UILabel?
override func sc_setUpCustomSubViews() {
backgroundColor = UIColor.clear
contentView.backgroundColor = UIColor.init(red:CGFloat(arc4random()%255)*1.0/255, green: CGFloat(arc4random()%255)*1.0/255, blue: CGFloat(arc4random()%255)*1.0/255, alpha:1)
contentView.layer.cornerRadius = 10
contentView.layer.masksToBounds = true
label = UILabel(frame: contentView.bounds)
label?.textColor = UIColor.white
label?.textAlignment = NSTextAlignment.center
contentView.addSubview(label!)
}
override func sc_loadParam(param: Any?) {
if param != nil {
let text = param as! String
label?.text = text
}else{
label?.text = ""
}
}
}
重寫兩個(gè)基礎(chǔ)方法
注冊
sc_prompt_register(viewClass:TestView.classForCoder(), showCommand: "test")
發(fā)送顯示命令
///隨機(jī)顏色顯示
func clickBtn(){
let str:String = "\(num)"
sc_prompt_show(showCommand: "test", param: str)
num += 1
}
其他Api
///高度
func sc_height() -> CGFloat {
}
///滑動(dòng)距離
func sc_slideDistanse() -> CGFloat {
}
///顯示時(shí)間
func sc_showTime() -> TimeInterval {
}
///出現(xiàn)動(dòng)畫時(shí)間
func sc_showAnimationDuration() -> TimeInterval {
}
///隱藏動(dòng)畫時(shí)間
func sc_hideAnimationDuration() -> TimeInterval {
}
必須重寫的方法
//MARK: load
///設(shè)置子控件
func sc_setUpCustomSubViews(){
}
func sc_loadParam(param:Any?){
}
SCPromptView
SCPromptView : A prompt view which show in the top of the screen .
Your star is my biggest motivation.
Install
Manually
Download the source code , copy folder SCPromptView into your project.
CocoaPod
pod 'SCPromptView'
Usage
The usage of SCPromptView is similar to the usage of UITableView.
Create Custom View
class TestView: SCPromptView {
var label:UILabel?
override func sc_setUpCustomSubViews() {
backgroundColor = UIColor.clear
contentView.backgroundColor = UIColor.init(red:CGFloat(arc4random()%255)*1.0/255, green: CGFloat(arc4random()%255)*1.0/255, blue: CGFloat(arc4random()%255)*1.0/255, alpha:1)
contentView.layer.cornerRadius = 10
contentView.layer.masksToBounds = true
label = UILabel(frame: contentView.bounds)
label?.textColor = UIColor.white
label?.textAlignment = NSTextAlignment.center
contentView.addSubview(label!)
}
override func sc_loadParam(param: Any?) {
if param != nil {
let text = param as! String
label?.text = text
}else{
label?.text = ""
}
}
}
Override two basic function.
Register
sc_prompt_register(viewClass:TestView.classForCoder(), showCommand: "test")
Show
///show random color
///隨機(jī)顏色顯示
func clickBtn(){
let str:String = "\(num)"
sc_prompt_show(showCommand: "test", param: str)
num += 1
}
Other Api
///高度
func sc_height() -> CGFloat {
}
///滑動(dòng)距離
func sc_slideDistanse() -> CGFloat {
}
///顯示時(shí)間
func sc_showTime() -> TimeInterval {
}
///出現(xiàn)動(dòng)畫時(shí)間
func sc_showAnimationDuration() -> TimeInterval {
}
///隱藏動(dòng)畫時(shí)間
func sc_hideAnimationDuration() -> TimeInterval {
}
MUST OVERRIDE
//MARK: load
///設(shè)置子控件
func sc_setUpCustomSubViews(){
}
func sc_loadParam(param:Any?){
}