Uygulamamı 3 cihazda deniyorum. IOS 9'da 2 cihaz ve iOS 8'de bir cihaz. IOS 9'da editActionsForRowAtIndexPath
işlevi çalışıyor ve bir hücreyi kaydırdığımda eylem gösteriliyor. Ancak iOS 8'de hücreleri kaydırmam.editActionsForRowAtIndexPod Xcode 7 ile iOS 8 üzerinde çalışmaz
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
let ShareAction = UITableViewRowAction(style: .Normal, title: "Partager", handler: { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
if AllArticle[indexPath.row].Title != nil && AllArticle[indexPath.row].Link != nil {
var ToShare = []
if self.search {
ToShare = [ArticleFiltered[indexPath.row].Link!]
} else {
ToShare = [AllArticle[indexPath.row].Link!]
}
let ActivityViewController = UIActivityViewController(activityItems: ToShare as [AnyObject], applicationActivities: nil)
self.presentViewController(ActivityViewController, animated: true, completion: {
self.TableView.setEditing(false, animated: true)
})
}
})
let FavoriteAction = UITableViewRowAction(style: .Normal, title: "Ajouté aux favoris", handler: { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
if AllArticle[indexPath.row].Favoris {
let alreadyInView = UIAlertController(title: "Favori déjà ajouté", message: "Cet article fait déjà parti de vos favoris", preferredStyle: .Alert)
let ActionAlert = UIAlertAction(title: "Ok", style: .Default) { (action) in }
alreadyInView.addAction(ActionAlert)
self.presentViewController(alreadyInView, animated: true, completion: nil)
} else {
AllArticle[indexPath.row].Favoris = true
let alreadyInView = UIAlertController(title: "Favori ajouté", message: "Cet article fait maintenant parti de vos favoris", preferredStyle: .Alert)
let ActionAlert = UIAlertAction(title: "Ok", style: .Default) { (action) in }
alreadyInView.addAction(ActionAlert)
self.presentViewController(alreadyInView, animated: true, completion: nil)
Favorite.append(indexPath.row)
saveFavoris()
}
self.TableView.setEditing(false, animated: true)
})
FavoriteAction.backgroundColor = UIColor.redColor()
return [ShareAction, FavoriteAction]
}
Ve tabii ki
eklenenviewDidLoad()
if TableView != nil {
TableView.delegate = self
TableView.dataSource = self
TableView.tableFooterView = UIView(frame: CGRectZero)
TableView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: "tapTableView"))
TableView.gestureRecognizers?.last?.delegate = self
}
onun Xcode hata Mayıs: Burada
benim kodudur? Herhangi bir fikrin var mı?Teşekkürler!
Aynı sorunu yaşıyorum. Her şey iOS 9'da iyi çalışıyor ancak 8'de değil. –
Xcode Gold Master bu hatayı düzeltti mi? –
Hata hala Xcode GM ile burada, bizim prog –