Created
March 4, 2011 05:00
-
-
Save rdeguzman/854197 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PADDING_VERTICAL 5.0f | |
#define BUTTON_HEIGHT 40.0f | |
#define BUTTON_WIDTH 160.0f | |
#define BUTTON_ORIGIN_X (320.0f - BUTTON_WIDTH)/2.0f | |
#define BUTTON_ORIGIN_Y 20.0f | |
- (void)initButtons{ | |
NSLog(@"MainViewController.initButtons"); | |
CGFloat totalHeight = BUTTON_ORIGIN_Y; | |
for(NSDictionary* section in arraySections){ | |
NSString* title = [section objectForKey:@"title"]; | |
UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; | |
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown]; | |
[button setTitle:title forState:UIControlStateNormal]; | |
button.frame = CGRectMake(BUTTON_ORIGIN_X, totalHeight, BUTTON_WIDTH, BUTTON_HEIGHT); | |
[self.view addSubview:button]; | |
totalHeight = totalHeight + BUTTON_HEIGHT + PADDING_VERTICAL; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment