Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. typedef NS_ENUM(NSInteger, TypesDisplay) {
  2. TYPE_DISPLAY_COLLECTION,
  3. TYPE_DISPLAY_LIST
  4.  
  5. // Embed segue for CatalogCollectionViewController
  6. if ([[segue identifier] isEqualToString:[MPStoryboard segueEmbedCatalog]])
  7. {
  8. self.catalogCollectionController = segue.destinationViewController;
  9. self.catalogCollectionController.typesDisplayCollection = TYPE_DISPLAY_COLLECTION;
  10.  
  11. self.catalogCollectionController.selectItemHandler = ^(NSIndexPath *indexPath) {
  12. [blockSafeSelf selectItemAtIndexPath:indexPath];
  13. };
  14.  
  15. }
  16.  
  17. // Embed segue for CatalogTableViewController
  18. else if ([[segue identifier] isEqualToString:[MPStoryboard segueEmbedCatalogTable]])
  19. {
  20. self.catalogTableViewController = segue.destinationViewController;
  21. self.catalogTableViewController.typesDisplayList = TYPE_DISPLAY_LIST;
  22.  
  23. self.catalogTableViewController.selectItemHandler = ^(NSIndexPath *indexPath) {
  24. [blockSafeSelf selectItemAtIndexPath:indexPath];
  25.  
  26. };
  27.  
  28. }
  29.  
  30. - (void)flipDisplayType
  31.  
  32. if ([self.catalogContainerView isHidden]){
  33.  
  34. [self.catalogContainerView setHidden:NO];
  35. [self.catalogTableContainerView setHidden:YES];
  36. self.catalogCollectionController.typesDisplayCollection = TYPE_DISPLAY_COLLECTION;
  37.  
  38.  
  39. MPNormalBarButtonItem *displayButton = [[MPNormalBarButtonItem alloc] initWithTitle:@"Liste" style:UIBarButtonItemStylePlain target:self action:@selector(flipDisplayType)];
  40.  
  41. [self.navigationItem setRightBarButtonItem:displayButton];
  42.  
  43. }else{
  44.  
  45. [self.catalogContainerView setHidden:YES];
  46. [self.catalogTableContainerView setHidden:NO];
  47. self.catalogTableViewController.typesDisplayList = TYPE_DISPLAY_LIST;
  48.  
  49. MPNormalBarButtonItem *displayButton = [[MPNormalBarButtonItem alloc] initWithTitle:@"Collection" style:UIBarButtonItemStylePlain target:self action:@selector(flipDisplayType)];
  50.  
  51. [self.navigationItem setRightBarButtonItem:displayButton];
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement