Thursday, November 18, 2010

Add buttons under a tableview


 (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];

}

No comments:

Post a Comment

Followers