我有几个UITableViewControllers
,他们有从文件夹到iOS设备的数据。我使用帮助AVMetaDataItem
从mp3文件导出艺术家的名字。我有几个名字,我有重复。如何从UITableViewCell
删除重复项?
var cellStrings: String!
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! UITableViewCell
var dataForCell = mp3Files[indexPath.row]
var generalURL: NSURL!
var documentFolder = fileManager.URLsForDirectory(NSSearchPathDirectory.DocumentDirectory, inDomains: NSSearchPathDomainMask.UserDomainMask)
if var urlFromFolder: NSURL = documentFolder.first as? NSURL {
generalURL = urlFromFolder.URLByAppendingPathComponent(dataForCell)
println("general \(generalURL)")
}
var player = AVPlayerItem(URL: generalURL)
var metaData = player.asset.commonMetadata as! [AVMetadataItem]
for item in metaData {
if item.commonKey == "artist" {
nameArtist = item.stringValue
}
}
cell.textLabel?.text = nameArtist
return cell
}