代码改变世界

swift开发笔记31

2018-02-11 15:21  dengchaojie_learner  阅读(145)  评论(0编辑  收藏  举报

self.tableView.scrollToRow(at: IndexPath.init(row: 0, section: 0), at: .top, animated: true)

self.tb.scrollRectToVisible(CGRect(x: 0, y: 48, width: self.tb.frame.size.width, height: self.tb.frame.size.width), animated: true)

 

String(format : "%.0f%@", floor(sender.value), "%")// 如果要显示%,需要格式化%@

 

isNaN//A Boolean value indicating whether the instance is NaN (“not a number”).

 

 

string.components(separatedBy: CharacterSet(charactersIn:"0123456789").inverted).joined(separator: "")//Returns an array containing substrings from the string that have been divided by characters in the given set.

 

NumberFormatter().number(from: self.returnAmountField().text!)// by parsing string using the receiver’s format, or nil if no single number could be parsed.