Skip to content

Instantly share code, notes, and snippets.

@rdeguzman
Created March 4, 2011 04:58
Show Gist options
  • Select an option

  • Save rdeguzman/854195 to your computer and use it in GitHub Desktop.

Select an option

Save rdeguzman/854195 to your computer and use it in GitHub Desktop.
Do we need to release button?
- (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