我在我的iOS应用中安装了Firebase.一切都在模拟器上正常工作,但在真实设备上它不会执行/返回查询到我的数据库.
我尝试清理项目,但它没有改变任何东西.
你有解决方案吗?
编辑:用代码更新
override func viewDidLoad() {
super.viewDidLoad()
// Setup Firebase
self.ref = FIRDatabase.database().reference()
self.ref.child("Database").observeEventType(.Value, withBlock: { (snapshot) in
if snapshot.exists() {
for rest in snapshot.children.allObjects as! [FIRDataSnapshot] {
print(rest.value)
}
} else {
}
}) { (error) in
print(error.localizedDescription)
}
}
Run Code Online (Sandbox Code Playgroud) 我在刷新UIViewController内的自定义UITableView时遇到问题。
当出现时,tableView的所有单元格都有清晰的背景色。我上面有一个“开始”按钮,当我单击它时,我希望所有单元格都具有另一种颜色。
我在以下位置指定了规则:
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if self.status == "start" {
if indexPath != self.currentIndexPath {
cell.backgroundColor = UIColor(red: 0 , green: 0, blue: 0, alpha: 0.5)
} else {
cell.backgroundColor = UIColor.clearColor()
}
} else {
cell.backgroundColor = UIColor.clearColor()
}
}
Run Code Online (Sandbox Code Playgroud)
在“开始”操作按钮中,我调用: self.tableView.reloadData
@IBAction func startAction(sender: AnyObject) {
self.currentIndexPath = NSIndexPath(forRow: 0, inSection: 0)
self.status = "start"
self.tableView.reloadData()
}
Run Code Online (Sandbox Code Playgroud)
但这不能很好地工作,因为我必须滚动以更新背景色。
我尝试使用该self.tableView.reloadRowsAtIndexPaths方法。但是结果是一样的。
我总是必须滚动tableView来更新背景色或某些图像。
我哪里错了?
我想用切片创建一个循环进度,其中每个切片都是一个弧.
我的代码基于这个答案: 从圆圈或甜甜圈中绘制片段
但我不知道如何复制它并旋转10次.我想按照进度变量(百分比)对其进行着色.
编辑:我想要这样的东西
请帮忙
问候