Hello,
I'm trying to create a view programmatically. The result that i want to have is a scroll view with a tableview inside. And under this table view i want to add some buttons
I don't know exactly how to do that i tried this but it doesn't work :
- (void)loadView {
[super loadView];
tableView = [[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStyleGrouped];
[tableView setDelegate:self];
[tableView setDataSource:self];
scrollView = [[UIScrollView alloc] initWithFrame:[[self view] bounds]];
//[scrollView setBackgroundColor:[UIColor blackColor]];
[scrollView setBouncesZoom:YES];
deconnectButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
[deconnectButton setTitle:@"Deconect" forState:UIControlStateNormal];
[deconnectButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
//[deconnectButton addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
deconnectButton.frame = tableView.frame;
NSLog(@"Tableview frame : %@", NSStringFromCGRect(tableView.frame));
[scrollView addSubview:deconnectButton];
[scrollView addSubview:tableView];
[[self view] addSubview:scrollView];
}
What am i missing or doing wrong?