我正在使用此库https://github.com/marketplacer/Dodo在没有互联网时显示状态栏。但即使编译了这些代码,也没有显示状态栏。我还通过UILabel替换这些渡渡鸟视图进行测试,并且标签显示。但为什么渡渡鸟的观点无法展示。任何人都可以解释我。
以下是代码:
var ftime = "03:00:00"; //retrieved from db
var ltime = "03:10:00"; //retrieved from db
答案 0 :(得分:1)
使用此更新代码:
if Reachability.isConnectedToNetwork() {
load()
} else if !Reachability.isConnectedToNetwork() {
view.dodo.style.label.color = UIColor.whiteColor()
view.dodo.style.bar.backgroundColor = DodoColor.fromHexString("#00000090")
view.dodo.style.bar.hideAfterDelaySeconds = 10
view.dodo.style.bar.hideOnTap = true
view.dodo.style.bar.locationTop = true
view.dodo.style.bar.onTap = { /* Button tapped */ }
view.dodo.show("No Internet")
}
示例ViewController:
import UIKit
导入渡渡鸟
类ViewController:UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.dodo.style.label.color = UIColor.whiteColor()
view.dodo.style.bar.backgroundColor = DodoColor.fromHexString("#00000090")
view.dodo.style.bar.hideAfterDelaySeconds = 10
view.dodo.style.bar.hideOnTap = true
view.dodo.style.bar.locationTop = true
view.dodo.style.bar.onTap = { /* Button tapped */ }
view.dodo.show("No Internet")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
如果仍然无法正常工作,请检查“isConnectedToNetwork”'实现并在代码的else部分放置调试断点。