Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. protocol CategoryRowDelegate {
  2. func didSelectItemAtIndexPath()
  3. }
  4. class CategoryRow:UITableViewCell {
  5. @IBOutlet weak var collectionView:UICollectionView!
  6. var delegate:CategoryRowDelegate?
  7. }
  8. extension CategoryRow:UICollectionViewDataSource {
  9. func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
  10. ImageObjectSingleton.imageName = DataSource.maskArray.objectAtIndex(indexPath.row) as! String
  11. ImageObjectSingleton.isEyeColorImage = false
  12. ImageObjectSingleton.isMaskImage = true
  13. delegate?.didSelectItemAtIndexPath()
  14. }}
  15.  
  16. class EffectsMenuViewContoller:UIViewController,UITableViewDataSource,UITableViewDelegate,CategoryRowDelegate {
  17. var object : CategoryRow?
  18.  
  19. override func viewDidLoad()
  20. {
  21. super.viewDidLoad()
  22. /* snip */
  23. self.object?.delegate = self
  24. }
  25. /* snip */
  26. func didSelectItemAtIndexPath() {
  27. self.dismissViewControllerAnimated(true, completion: nil)
  28. }
  29.  
  30. protocol CategoryRowDelegate: class {
  31. func didSelectItemAtIndexPath()
  32. }
  33.  
  34. class CategoryRow:UITableViewCell {
  35.  
  36. @IBOutlet weak var collectionView:UICollectionView!
  37.  
  38. weak var delegate: CategoryRowDelegate?
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement