UIButton under grouped table

Basically, I want to create a button underneath a grouped table view like contacts.app to delete contacts.

I can create the button ok, I'm a bit confused as to how to decide where to place it.

I thought I could just do:

CGRect bounds = [[self tableView] bounds];

      

Then place a button based on that.

However, when accessing the size.height of the bounds, I get null! Is there a dynamic way to get the height of the tableView that I might lose?

Any help is greatly appreciated.

Rich

+2


source to share


3 answers


You can create the size of your button like

CGRect buttonFrame = CGRectMake(0, 0, width, height);

      



Create a button with this frame and then set the button as footer tableView

myTableView.tableFooterView = myButton;

      

+3


source


You can try to create a custom footer with the buttons that were placed in this view by implementing these methods:

- (CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- (UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section

      



This will allow you to place any number of buttons in the table below the section you want.

+1


source


You can get the view of tablewViews by looking at its frame

CGRect bounds= [[self tableView] frame]; 
float heigh= frame.size.height;

      

-1


source







All Articles