Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void) saveUserFilesToArray;
- {
- NSString *slidePath = [globe.pathToSave stringByAppendingPathComponent:@"/UserSlides"];
- NSString *iconPath = [globe.pathToSave stringByAppendingPathComponent:@"/UserIcons"];
- NSArray *iconContents = [globe.fileSystem contentsOfDirectoryAtPath:iconPath error:nil];
- NSArray *slideContents = [globe.fileSystem contentsOfDirectoryAtPath:slidePath error:nil];
- customIcon = iconContents;
- customSlide = slideContents;
- }
- - (void) loadCustomScroll
- {
- for (int i = 0; i < [customIcon count]; i++)
- {
- NSString* path = [globe.pathToSave stringByAppendingPathComponent: [NSString stringWithFormat:@"UserIcons/%@", customIcon[i]]];
- UIImage* imageToUse = [UIImage imageWithContentsOfFile:path];
- UIView *overlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"menuSingle"]];
- UIButton *icon1 = [UIButton buttonWithType:UIButtonTypeCustom];
- [icon1 setBackgroundImage:imageToUse forState:UIControlStateNormal];
- icon1.showsTouchWhenHighlighted = YES;
- icon1.titleLabel.text = customSlide[i];
- icon1.titleLabel.hidden = YES;
- [icon1 addTarget:self action:@selector(getName:) forControlEvents:UIControlEventTouchUpInside];
- CGRect scrollFrame;
- scrollFrame.origin = customSlideView.frame.origin;
- scrollFrame.size = CGSizeMake(200, 200 * i + 200);
- customSlideView.frame = scrollFrame;
- CGRect overlayFrame = overlay.frame;
- CGRect icon1Frame = icon1.frame;
- overlayFrame.size.width = 200;
- overlayFrame.size.height = 200;
- [overlay setFrame:overlayFrame];
- icon1Frame.size.width = 200;
- icon1Frame.size.height = 200;
- [icon1 setFrame:icon1Frame];
- [customSlideView addSubview: icon1];
- [customSlideView addSubview: overlay];
- CGPoint pt = CGPointMake((overlay.frame.size.width/2) + 65, (overlay.frame.size.height/2) + (overlay.frame.size.height * i));
- CGPoint iconLeft = CGPointMake((overlay.frame.size.width/2) + 65, (overlay.frame.size.height/2) + (overlay.frame.size.height * i));
- overlay.center = pt;
- icon1.center = iconLeft;
- customSlideView.contentSize = CGSizeMake(200, 200 * i + 200);
- }
- }
- - (void)getName:(UIButton *)sender
- {
- globe.selectedPic = sender.titleLabel.text;
- [self performSegueWithIdentifier:@"customDisplay" sender:self];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement