我一直在使用sendAction方法 with来传达来自to 的nil target操作,而不是实现委托。Cells(UITableViewCell/UICollectionViewCell)ViewControllers
自 Swift 2.2 以来,选择器的语法已更新,我收到一些警告。新#selector语法坚持指定selectorname后跟classname. 如果我提到类名,那么将目标设置为 nil 就没有意义。
有什么解决方法吗?
class RedeemCell: UICollectionViewCell {
@IBAction func redeemAction(sender: AnyObject) {
UIApplication.sharedApplication().sendAction("updateCartWithTotalAmountPayableWithDiscount:", to: nil, from: self, forEvent: nil)
}
}
class CartVC: UIViewController {
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell: UICollectionViewCell?
cell = collectionView.dequeueReusableCellWithReuseIdentifier("redeempoints", forIndexPath: indexPath)
return cell!;
}
func updateCartWithTotalAmountPayableWithDiscount(sender: AnyObject) {
print("this will be called as the action movies through responderchain …Run Code Online (Sandbox Code Playgroud) 我有3个viewControllers - BaseViewController-> AviewController-> BviewController.
AviewController在BaseViewController上以模态方式呈现,BviewController在AviewController上以模态方式呈现.
在AviewController中,如果我调用[self dismissViewControllerAnimated:Completion]它,则会关闭AviewController和BviewController.
在BviewController中如果我调用[self.presentingViewController dismissViewControllerAnimated:completion]它只会解散BviewController.为什么AviewController没有被解雇?
这个概念是错误的AviewController = BviewController.presentingViewController.?
我也尝试在BviewContrroller中使用AviewController的弱引用并试图解雇.但仍然只有BviewController被解雇.即[AviewControllerReference dismissViewControllerAnimated:completion]
我理解这个概念有什么错误吗?
该应用程序使用bundle目录中的静态sqlite(初始数据)作为Coredata的持久存储.sqlite有7个表,其中一个表通过添加额外的列/字段进行修改.如何让coreData了解持久存储(存储)已更改并且需要采用新更新?对于sqlite有什么样的版本概念,就像我们为coredata做的那样吗?