Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Header file
- @interface CameraViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
- {
- UIScrollView *filtersScrollView;
- }
- //Implementation file
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- [self customControl];
- }
- -(void)customControl
- {
- filtersScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 400, self.view.bounds.size.width, 90)];
- [filtersScrollView setScrollEnabled:YES];
- [filtersScrollView setShowsVerticalScrollIndicator:NO];
- [filtersScrollView setShowsHorizontalScrollIndicator:NO];
- int x = 10;
- //create a new dynamic button
- for (int j=0; j<=10; j++)
- {
- CGRect frame = CGRectMake(x, 0, 70, 70);
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setTag:j];
- CALayer *layer = [button layer];
- [layer setCornerRadius:0.0];
- [layer setBorderColor:[[UIColor whiteColor] CGColor]];
- [layer setMasksToBounds:YES];
- [layer setBorderWidth:2.0];
- button.frame = frame;
- [button addTarget:self action:@selector(filterButton:) forControlEvents:UIControlEventTouchUpInside];
- [self.filterScrollview addSubview:button];
- x= x+10;
- }
- [filtersScrollView setContentSize:CGSizeMake(400, 100)];
- [self.view addSubview:filtersScrollView];
- }
Advertisement
Add Comment
Please, Sign In to add comment