我遇到过很多与此类似的问题,但很多都是针对旧版本的Xcode,或者根本就没用。 我使用Xcode版本8.3.2(8E2002)和Swift编码语言。我对编码知之甚少,但我很年轻,渴望学习! 我正在创建一个clicker game,它会为您提供每秒游戏本身的资金。因此,如果你闲置2分钟,它会给你120美元(120秒每秒1美元)。除此之外,您还可以通过单击主要对象来赚钱。 到目前为止,这是我的编码:
import UIKit
class ViewController: UIViewController {
var score = 0
var add = 1
func addpersec() {
score += 1
}
//func used to add to the score based timer. Aka, adding 1 per second
@IBOutlet weak var scorecount: UILabel!
@IBAction func clicks(_ sender: Any) {
score += 1
scorecount.text = "Honey: \(score)"
}
@IBOutlet weak var Bees: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
答案 0 :(得分:4)
with sub as
(
select subcl.idclient, subf.clasification_value
, subcl.client_name, subcl.client_code
, convert(varchar(20), subd.documents_series)+''+
convert(varchar(6), subd.document_number) as invoice_series
from invoices.clients subcl
inner join invoices.clasifications subf
on subf.cid_clasification = cl.cid_clasifclient1
inner join invoices.documents subd
on subd.cid_client = cl.cid_client
)
select distinct m.date, m.productcode, p.productname
, f.family, cl.clientname, cl.clientcode
, m.quantity, m.price, m.credit, m.total
, m.exchange,m.state, m.city
, sub.clasification_value, sub.invoice_series
from invoices.movements m
inner join invoices.products p
on m.idproduct = p.idproduct
left outer join invoices.documents d
on m.iddocument = d.iddocument
inner join invoices.coins c
on d.idcoin = c.idcoin
inner join invoices.address a
on a.iddocument = d.iddocument
inner join invoices.clasifications f
on f.family='aspen'
inner join invoices.clients cl
on d.idclient = cl.idclient
inner join sub
on sub.idclient = cl.idclient
要使计时器无效,请致电class ViewController: UIViewController {
var timer: Timer? = nil // Property
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(handleTimer), userInfo: nil, repeats: true)
}
func handleTimer(_ timer: Timer) {
print("Timer ticking!")
}
}
答案 1 :(得分:0)
您的问题似乎与iOS UI有关,因此我不知道我的回答是否有意义。
对于通用延迟函数执行(如Javascript' DispatchQueue
),您可以使用// have this as a global somewhere
let bg = DispatchQueue(label: "bg", qos: .background, target: nil)
// anywhere else in your code:
// First decide the time to execute your function
let delayInSeconds = 3
let when = DispatchTime.now() + delayInSeconds
// call it
bg.asyncAfter(deadline: when) {
// code to execute later (this is the body of an anonymous function)
}
{{1}}