class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { override func viewDidLoad() { super.viewDidLoad() self.tableView.dataSource = self self.tableView.delegate = self // 加上這一行才不會看不到TouchDown的效果 self.tableView.delaysContentTouches = false //... } //... // MARK: - UITableViewDelegate func tableView(tableView: UITableView, didHighlightRowAtIndexPath indexPath: NSIndexPath) { let cell = tableView.cellForRowAtIndexPath(indexPath)! cell.alpha = 0.3 } func tableView(tableView: UITableView, didUnhighlightRowAtIndexPath indexPath: NSIndexPath) { let cell = tableView.cellForRowAtIndexPath(indexPath)! cell.alpha = 1 } }
var amount = NSNumber(int: 8880) var _currencyFormatter = NSNumberFormatter() _currencyFormatter.numberStyle = NSNumberFormatterStyle.DecimalStyle //_currencyFormatter.currencyCode = "NT$ " //_currencyFormatter.formatterBehavior = NSNumberFormatterBehavior.BehaviorDefault //_currencyFormatter.negativeFormat = "-$#,##0" _currencyFormatter.positiveFormat = "NT$ #,##0" _currencyFormatter.stringFromNumber(amount) 輸出結果︰ NT$ 8,880 參考︰ http://www.cokco.cn/thread-35548-1-1.html http://www.freair.com/bbs/simple/?t558.html
留言
張貼留言