如何增加Android Studio中撤消/重做历史记住的事件数量? 我已经习惯了Eclipse记住了大量的步骤,而且我通常可以恢复到我开始处理文件的时候,即使它已经有数百次编辑了,但是Android Studio记得要回到相当少的步骤
答案 0 :(得分:7)
相对于this thread,您可以尝试更改 func changeButtonColors(){
//let myBtn
let timer = NSTimer.scheduledTimerWithTimeInterval(2.0, target: self, selector: "changeColor", userInfo: nil, repeats: true)
timer.fire()
}
//cloros to iterate over each time
let colorChoice = [UIColor.blackColor(), UIColor.blueColor(), UIColor.redColor()]
var counter = 0 //tracking variable
//this gets called when by the timer
//currently it is supposed to go on forever.
func changeColor(){
//suppose i have the button outlet named myBtn
UIView.animateWithDuration(2.0, animations: { () -> Void in
myBtn.backgroundColor = colorChoice[counter]
if counter < colorChoice.count{
counter++
}else{
counter = 0
//or disable the alert
//timer.invalidate()
}
})
}
值,但这可能会导致未来的麻烦,至少内存溢出( stackowerflow :))。要编辑它: