按照http://scalate.github.io/scalate/documentation/installing.html
在OSX Yosemite上安装scalate时出现以下错误brew install scalate
Error: No available formula for scalate
Searching formulae...
Searching taps...
有什么想法吗?
答案 0 :(得分:0)
func tableView(tableView: UITableView,
editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
let play = UITableViewRowAction(style: .Default, title: "Play", handler: { (action, indexPath) in
self.tableView.dataSource?.tableView?(
self.tableView,
commitEditingStyle: .Delete,
forRowAtIndexPath: indexPath
)
let dispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
dispatch_async(dispatchQueue, {
let url = self.sharedRec.audioDic[indexPath.row]["audioURL"] as String!
let kingURL = "\(url)"
print(kingURL)
if let data = NSData(contentsOfFile: kingURL) {
do {
print("PLAYING AUDIO WORKED!") // NOT WORKING ANYMORE
self.audioPlayer = try AVAudioPlayer(data: data)
self.audioPlayer.delegate = self
self.audioPlayer.prepareToPlay()
self.audioPlayer.play()
// Progress View Code
NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: #selector(RecordPanel.updateAudioProgressView), userInfo: nil, repeats: true)
} catch {
print("ERROR BOY \(kingURL)")
print("\(error)")
}
}
})
print("I PLAYED")
return
})
let pause = UITableViewRowAction(style: .Default, title: "Pause", handler: { (action, indexPath) in
self.tableView.dataSource?.tableView?(
self.tableView,
commitEditingStyle: .Delete,
forRowAtIndexPath: indexPath
)
if let player = self.audioPlayer {
player.pause()
}
return
})
let delete = UITableViewRowAction(style: .Default, title: "Delete", handler: { (action, indexPath) in
self.tableView.dataSource?.tableView?(
self.tableView,
commitEditingStyle: .Delete,
forRowAtIndexPath: indexPath
)
let uid = NSUserDefaults.standardUserDefaults().valueForKey("uid") as! String // uid
DataService.dataService.deleteAudio(uid, project: self.sharedRec.projectName, vocalString: self.sharedRec.audioString )
let currURL = self.sharedRec.audioString
let url = "\(currURL).caf"
//Document Directory
let dirPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]
// Full File to Delete Location
let fileURL = dirPath.stringByAppendingPathComponent(url)
// This is to print out all directory files
let documentsUrl = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first!
do {
try NSFileManager.defaultManager().removeItemAtPath(fileURL)
print("file deleted \(fileURL)")
let directoryContents = try NSFileManager.defaultManager().contentsOfDirectoryAtURL(documentsUrl, includingPropertiesForKeys: nil, options: NSDirectoryEnumerationOptions())
print(directoryContents)
} catch {
print("error")
}
return
})