'de yazılan bir iOS
Xcode 7 projem var. Ben NSCoding
kullanarak app fotoğrafları saklıyorum:Kaydedilen resimlerden UITableView klasörleri oluşturun
class UserImages: NSObject, NSCoding {
// MARK: Properties
var name: String
var photo: NSData // UIImage
...
}
Bu görüntüler henüz UITableView
gösterilmiştir:
class ImagesTableViewController: UIViewController, UITableViewDelegate {
// MARK: Properties
var photos = [UserImages]()
...
// MARK: TableView Details
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return photos.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "ImageTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! ImageTableViewCell
let photo = photos[indexPath.row]
var image: NSData = photo.photo as NSData
cell.nameLabel.text = photo.name
cell.photoImageView.image = UIImage(data: image)
return cell
}
}
büyük İşleri ve benim özel hücrede, bir UILabel
ve UIImageView
için sahip isim ve fotoğraf.
Sorum, kullanıcının UITableView
içinde klasör oluşturmasına nasıl izin verebilir ve fotoğrafların klasörlerde taşınmasına/organize edilmesine izin verebilir miyim? Ben klasörleri uygulamak ve hala NSCoding kullanmak mümkün olmadıkça NSCoding tutmak ve tutmak istiyorum. Teşekkür ederim.