0

Any suggestions on how i can add an extra 40 round rect buttons to my view controller... i have tried doing it through storyboard but of course as you can understand the only editable spaces is the one visible within the view controller.

So i take it i have to use code to add an extra 40 round rect buttons which are editable so that i can rename them and also so that i can link outlets to each individual one as each will be playing a separate short video.

Also the reason i have chosen buttons instead of a table view is because this view controller is gonna be accessed by purchases made from my "In App Purchases" with hope of being able to blur/Deactivate some buttons/purchases if they havent been purchased yet. Or Can the table view do that also?

Here is my code for the .h file for the scroll view

@interface ViewController17 : UIViewController <UIScrollViewDelegate> {
IBOutlet UIScrollView *scroller1;
}

@property (nonatomic, strong) UIScrollView *scroller1;
@end

Here is my code for the .m file for the scroll view

@implementation ViewController17
@synthesize scroller1;

- (void)viewDidLoad {
[scroller1 setScrollEnabled:YES];
[scroller1 setContentSize:CGSizeMake(320, 4000)];
scroller1.maximumZoomScale = 4.0;
scroller1.minimumZoomScale = 0.75;
scroller1.clipsToBounds = YES;
//here is the delegate portion below
scroller1.delegate = self;
[self.view bringSubviewToFront:scroller1];
[super viewDidLoad];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end
rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 3
    Consider using a collection view or table view with a custom cell instead. That way, you only have to create one button and can easily extend the number of "records". – Marcus Adams Jul 24 '13 at 20:56
  • @paulCezanne For one its not a dupe because dont forget im adding a UIbutton to a scrollview. Also when i say i have tried i mean i have tried adding the buttons through storyboard but i cant add 40 buttons as theres not enough available space in the viewcontroller to do that through editing and i cant resize the view controller either so i take it have to do it through code – user2459150 Jul 24 '13 at 20:58
  • 1
    You can make the scroll view in your storyboard bigger. See [this answer](http://stackoverflow.com/a/16889377/77567). – rob mayoff Jul 24 '13 at 20:59
  • @marcusAdams how do i add that to my code or can you add it to the code i already posted and explain the methods please – user2459150 Jul 24 '13 at 20:59
  • @robmayoff Yes ive tried making the scroll view bigger/longer but you can only add buttons within the viewcontroller so even if i make the scroll view longer it doesnt make a difference .... Also HINt thats why my scroll view height is at 4000 in my code – user2459150 Jul 24 '13 at 21:02
  • 1
    “You can only add buttons within the viewcontroller”. You have to make the top-level view bigger too. Read the answer I linked. It explains how to do it. – rob mayoff Jul 24 '13 at 21:03
  • @rofmayoff **Also** the reason i have chosen buttons instead of a table view is because this view controller is gonna be accessed by purchases made from my **"In App Purchases"** with hope of being able to blur/Deactivate some buttons/purchases if they havent been purchased yet. Or Can the table view do that also? P.S thanks your answer is what i need exactly please post it as an answer so that everybody knows. its sure gonna save me the hustle of having to code – user2459150 Jul 24 '13 at 21:08
  • You can vote up that answer if it answered your question, and let this question be closed as a duplicate. You can certainly use a table view to make a big list of buttons, and selectively deactivate some of the buttons, but that is a different question and should be posted separately after you've tried to do it yourself. – rob mayoff Jul 24 '13 at 21:13

0 Answers0