NSNotificationCenter.defaultCenter().postNotificationName(ZYShowPhotoBrowserController, object: self, userInfo: ["bmiddle_pic": self.viewModel!.bmiddle_pic!, "indexPath": indexPath])
//注册通知
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(HomeTableViewController.showBrowser(_:)), name: ZYShowPhotoBrowserController, object: nil)
deinit{
//移除通知
NSNotificationCenter.defaultCenter().removeObserver(self)
}
@objc private func showBrowser(notice: NSNotification)
{
guard let pictures = notice.userInfo!["bmiddle_pic"] as? [NSURL] else{
return
}
guard let index = notice.userInfo!["indexPath"] as? NSIndexPath else{
return
}
let vc = ZYBrowserViewController(bmiddle_pic: pictures, indexPath: index)
presentViewController(vc, animated: true, completion: nil)
}
网友评论