Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding buttons to viewForFooterSection UITableView
    primarykey
    data
    text
    <p>after some discussion on <a href="https://stackoverflow.com/questions/8301560/scrollable-all-the-way-uitableview">this topic</a> I'm attemting to implement 2 buttons on the footerview on a UItableView. To create the buttons, I declare them on the declaration .h file, synthesized on the implementation .m file and then, I created them by code, like this:</p> <pre><code>- (UIButton *)resetButton{ if (resetButton == nil) { resetButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; resetButton.frame = CGRectMake(20.0, 40 , 95.0, 37.0); [resetButton setTitle:@"Reset" forState:UIControlStateNormal]; resetButton.backgroundColor = [UIColor clearColor]; [resetButton addTarget:self action:@selector(resetAction:) forControlEvents:UIControlEventTouchDown]; resetButton.tag = 1; } return resetButton; } </code></pre> <p>and then, I implemented this code into the UITableView delegate method:</p> <pre><code>- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 100.0)]; [customView addSubview:self.resetButton]; [customView addSubview:self.calculateButton]; return [customView autorelease]; } </code></pre> <p>by doing so, the buttons appear on the screen however, when I tap them, nothing happens (I implemented a AlertView on the actions to check if they work.</p> <p>any help here?</p> <p>Thanks!</p> <p>EDIT: the actions linked to the button:</p> <pre><code>-(IBAction)resetAction:(id)sender { UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Reset" message:@"You just pressed the Reset button" delegate:self cancelButtonTitle:@"Acknowledged" otherButtonTitles:nil]; [alert show]; [alert release]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload