(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];
}
it given the information about how to develop the iphone application and games.......
Thursday, November 18, 2010
Add buttons under a tableview
UIButton in UITableView cell like “Delete Event”
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//..yadayadayada
cell = [tableView dequeueReusableCellWithIdentifier:@"buttonCell"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"buttonCell"] autorelease];
}
UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoDark];
[button setBackgroundColor:[UIColor redColor]];
button.titleLabel.text = @"Foo Bar";
[cell.contentView addSubview:button];
Subscribe to:
Posts (Atom)