Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. - (void) saveUserFilesToArray;
  2. {
  3.  
  4. NSString *slidePath = [globe.pathToSave stringByAppendingPathComponent:@"/UserSlides"];
  5. NSString *iconPath = [globe.pathToSave stringByAppendingPathComponent:@"/UserIcons"];
  6.  
  7. NSArray *iconContents = [globe.fileSystem contentsOfDirectoryAtPath:iconPath error:nil];
  8. NSArray *slideContents = [globe.fileSystem contentsOfDirectoryAtPath:slidePath error:nil];
  9.  
  10. customIcon = iconContents;
  11. customSlide = slideContents;
  12.  
  13. }
  14.  
  15. - (void) loadCustomScroll
  16. {
  17. for (int i = 0; i < [customIcon count]; i++)
  18. {
  19. NSString* path = [globe.pathToSave stringByAppendingPathComponent: [NSString stringWithFormat:@"UserIcons/%@", customIcon[i]]];
  20. UIImage* imageToUse = [UIImage imageWithContentsOfFile:path];
  21.  
  22. UIView *overlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"menuSingle"]];
  23. UIButton *icon1 = [UIButton buttonWithType:UIButtonTypeCustom];
  24. [icon1 setBackgroundImage:imageToUse forState:UIControlStateNormal];
  25.  
  26. icon1.showsTouchWhenHighlighted = YES;
  27. icon1.titleLabel.text = customSlide[i];
  28. icon1.titleLabel.hidden = YES;
  29.  
  30. [icon1 addTarget:self action:@selector(getName:) forControlEvents:UIControlEventTouchUpInside];
  31.  
  32. CGRect scrollFrame;
  33. scrollFrame.origin = customSlideView.frame.origin;
  34. scrollFrame.size = CGSizeMake(200, 200 * i + 200);
  35. customSlideView.frame = scrollFrame;
  36.  
  37. CGRect overlayFrame = overlay.frame;
  38. CGRect icon1Frame = icon1.frame;
  39.  
  40. overlayFrame.size.width = 200;
  41. overlayFrame.size.height = 200;
  42. [overlay setFrame:overlayFrame];
  43.  
  44. icon1Frame.size.width = 200;
  45. icon1Frame.size.height = 200;
  46. [icon1 setFrame:icon1Frame];
  47.  
  48. [customSlideView addSubview: icon1];
  49. [customSlideView addSubview: overlay];
  50.  
  51. CGPoint pt = CGPointMake((overlay.frame.size.width/2) + 65, (overlay.frame.size.height/2) + (overlay.frame.size.height * i));
  52.  
  53. CGPoint iconLeft = CGPointMake((overlay.frame.size.width/2) + 65, (overlay.frame.size.height/2) + (overlay.frame.size.height * i));
  54.  
  55.  
  56. overlay.center = pt;
  57.  
  58. icon1.center = iconLeft;
  59.  
  60. customSlideView.contentSize = CGSizeMake(200, 200 * i + 200);
  61.  
  62. }
  63. }
  64.  
  65. - (void)getName:(UIButton *)sender
  66. {
  67. globe.selectedPic = sender.titleLabel.text;
  68.  
  69. [self performSegueWithIdentifier:@"customDisplay" sender:self];
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement