I have added 2 button in a row of table view, for all the rows, and these button clicked as it first time appear in table view , when I scroll the table list the button tapping disable,
here is my code
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"ImageOnRightCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.userInteractionEnabled = NO;
UIButton *finalPriceBtn=[UIButton buttonWithType:UIButtonTypeCustom];
UIButton *finalPriceBtn1=[UIButton buttonWithType:UIButtonTypeCustom];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
int i=indexPath.row;
finalPriceBtn.backgroundColor=[UIColor redColor];
finalPriceBtn.tag=MAINLABEL_TAG;
finalPriceBtn.frame = CGRectMake(200, 0.0, 100, 50);
[finalPriceBtn addTarget:self action:#selector(goBtnClk:) forControlEvents:UIControlEventTouchUpInside];
finalPriceBtn.titleLabel.font=[UIFont systemFontOfSize:12];
finalPriceBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
[finalPriceBtn setImage:[UIImage imageNamed:#"man.jpg"] forState:UIControlStateNormal ];
[cell.contentView addSubview:finalPriceBtn];
finalPriceBtn1.backgroundColor=[UIColor redColor];
finalPriceBtn1.tag=SECONDLABEL_TAG;
finalPriceBtn1.frame = CGRectMake(50.0, 0.0, 80.0, 45.0);
[finalPriceBtn1 addTarget:self action:#selector(goBtnClk:) forControlEvents:UIControlEventTouchUpInside];
finalPriceBtn1.titleLabel.font=[UIFont systemFontOfSize:12];
finalPriceBtn1.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
[finalPriceBtn1 setImage:[UIImage imageNamed:#"bulk-female.jpg"] forState:UIControlStateNormal ];
[cell.contentView addSubview:finalPriceBtn1];
}
else
{
finalPriceBtn = (UIButton *)[cell.contentView viewWithTag:MAINLABEL_TAG];
finalPriceBtn1 = (UIButton *)[cell.contentView viewWithTag:SECONDLABEL_TAG];
}
return cell;
}
It is happening because, each time you are scrolling the tableview, your cells are reused and in that case cell is not nil and the code above the code before the cell==nil, makes the userInteractionEnabled to NO. That's why, your button is not clickable.
First time those buttons are clickable because they were not allocated, I mean the cell was not allocated and setting any attribute to non-allocated entity makes no effect. Hope you got the point.
Related
i am working with the tableview in which i added 2 buttons on one cell. Below is the code which i used
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.backgroundView =[[UIImageView alloc] initWithImage:[ [UIImage imageNamed:#"list-bg.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
tickbtn = [UIButton buttonWithType:UIButtonTypeCustom];
tickbtn.tag = 200+indexPath.row;
[tickbtn setBackgroundImage:[UIImage imageNamed:#"ok_gray.png"]forState:UIControlStateNormal];
[tickbtn addTarget:self action:#selector(addshed:) forControlEvents:UIControlEventTouchUpInside];
tickbtn.frame = CGRectMake(220, 10, 30, 30);
[cell.contentView addSubview:tickbtn];
NSLog(#"tickbtn tag %ld",(long)tickbtn.tag);
crossbtn = [UIButton buttonWithType:UIButtonTypeCustom];
crossbtn.tag = 400+indexPath.row;
[crossbtn setBackgroundImage:[UIImage imageNamed:#"delete-gray.png"]forState:UIControlStateNormal];
[crossbtn addTarget:self action:#selector(removeshed:) forControlEvents:UIControlEventTouchUpInside];
crossbtn.frame = CGRectMake(250, 10, 30, 30);
[cell.contentView addSubview:crossbtn];
NSLog(#"tickbtn tag %ld",(long)crossbtn.tag);
return cell;
}
on the tickbtn and crossbtn i am applying following actions :-
-(IBAction)addshed:(UIControl *)sender
{
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:sender.tag-200 inSection:0];
UITableViewCell *cell = (UITableViewCell*)[list_table cellForRowAtIndexPath:indexPath];
UIButton *check1 = (UIButton*)[cell.contentView viewWithTag:indexPath.row+200];
UIButton *check2 = (UIButton*)[cell.contentView viewWithTag:indexPath.row+400];
UIImageView *btnimg1 = [[UIImageView alloc] initWithImage:check1.currentBackgroundImage];
//UIImageView *btnimg2 = [[UIImageView alloc] initWithImage:check2.currentBackgroundImage];
NSLog(#"SHED LIST subviews: %#", btnimg1.image);
// Shed_data *sheddata = [[Shed_data alloc] init];
if (btnimg1.image == [UIImage imageNamed:#"ok_gray.png"]) {
//btnimg.image = [UIImage imageNamed:#"ok_gray.png"];
[check1 setBackgroundImage:[UIImage imageNamed:#"ok_green.png"]forState:UIControlStateNormal];
[check2 setBackgroundImage:[UIImage imageNamed:#"delete-gray.png"]forState:UIControlStateNormal];
[self addsheddata:sender];
NSLog(#"tickbtn tag %ld",(long)tickbtn.tag);
}
else if (btnimg1.image == [UIImage imageNamed:#"ok_green.png"])
{
[check2 setBackgroundImage:[UIImage imageNamed:#"delete-red.png"]forState:UIControlStateNormal];
[check1 setBackgroundImage:[UIImage imageNamed:#"ok_gray.png"]forState:UIControlStateNormal];
[self removesheddata:sender];
}
}
-(IBAction)removeshed:(UIControl*)sender
{
//.…………………….. My functionality
}
but in both these cases i am getting the tag value of last cell only whenever i am pressing the buttons of the cell.
Please locate my error and help me out to solve it. Your help will be much appreciable.
Try this one as working fine for me. I Just tested with my Xcode 5.
Modification :
1. I Create an NSMutableArray with the name of _objects (_objects = [[NSMutableArray alloc]initWithObjects:#"one",#"two",#"thre", nil];). and give it to my UITableView.
2.Give the tickBtn and crossBtn an different color so easily visible.
3.change the button pressed function to UIControl to UIButton like -(IBAction)addshed:(UIButton *)sender and when button pressed i catch the tag value and print it out on the console.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"Cell" forIndexPath:indexPath];
cell.textLabel.text = [_objects objectAtIndex:indexPath.row];
cell.backgroundView =[[UIImageView alloc] initWithImage:[ [UIImage imageNamed:#"list-bg.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
tickbtn = [UIButton buttonWithType:UIButtonTypeCustom];
tickbtn.tag = 200+indexPath.row;
[tickbtn setBackgroundImage:[UIImage imageNamed:#"ok_gray.png"]forState:UIControlStateNormal];
[tickbtn setBackgroundColor:[UIColor blackColor]];
[tickbtn addTarget:self action:#selector(addshed:) forControlEvents:UIControlEventTouchUpInside];
tickbtn.frame = CGRectMake(220, 10, 30, 30);
[cell.contentView addSubview:tickbtn];
NSLog(#"tickbtn tag %ld",(long)tickbtn.tag);
crossbtn = [UIButton buttonWithType:UIButtonTypeCustom];
crossbtn.tag = 400+indexPath.row;
[crossbtn setBackgroundImage:[UIImage imageNamed:#"delete-gray.png"]forState:UIControlStateNormal];
[crossbtn addTarget:self action:#selector(removeshed:) forControlEvents:UIControlEventTouchUpInside];
crossbtn.frame = CGRectMake(250, 10, 30, 30);
[crossbtn setBackgroundColor:[UIColor greenColor]];
[cell.contentView addSubview:crossbtn];
NSLog(#"tickbtn tag %ld",(long)crossbtn.tag);
return cell;
}
-(IBAction)addshed:(UIButton *)sender {
NSLog(#"add shed %d",sender.tag);
}
-(IBAction)removeshed:(UIButton *)sender {
NSLog(#"remove %d",sender.tag);
}
NEW QUESTION UPDATE
Did you try with 10 or more cells and try with some continuous scroll?
And the result is
As the Another Answer says
[cell addSubview:crossbtn];// -------- Change here ---------
Let me clear this as i know about it.
The contentView is a subview of UITableViewCell. please review this reference and here you can see there are actually 3 subviews in a UITableViewCell.
You need to add your button to cell subview not cell's contentview subview. So use this code....
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.backgroundView =[[UIImageView alloc] initWithImage:[ [UIImage imageNamed:#"list-bg.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
tickbtn = [UIButton buttonWithType:UIButtonTypeCustom];
tickbtn.tag = 200+indexPath.row;
[tickbtn setBackgroundImage:[UIImage imageNamed:#"ok_gray.png"]forState:UIControlStateNormal];
[tickbtn addTarget:self action:#selector(addshed:) forControlEvents:UIControlEventTouchUpInside];
tickbtn.frame = CGRectMake(220, 10, 30, 30);
[cell addSubview:tickbtn];// -------- Change here ---------
NSLog(#"tickbtn tag %ld",(long)tickbtn.tag);
crossbtn = [UIButton buttonWithType:UIButtonTypeCustom];
crossbtn.tag = 400+indexPath.row;
[crossbtn setBackgroundImage:[UIImage imageNamed:#"delete-gray.png"]forState:UIControlStateNormal];
[crossbtn addTarget:self action:#selector(removeshed:) forControlEvents:UIControlEventTouchUpInside];
crossbtn.frame = CGRectMake(250, 10, 30, 30);
[cell addSubview:crossbtn];// -------- Change here ---------
NSLog(#"tickbtn tag %ld",(long)crossbtn.tag);
return cell;
}
Your code seems fine for cellForRowAtIndexpath:. Error might be in getting the tag value at button click. Try to change with this code:-
-(IBAction)addshed:(UIControl *)sender
{
//.…………………….. My functionality
int selectedRow1 = ((UIControl *)sender).tag;
NSLog(#"No. %d", selectedRow1);
}
I have seen issue. It may be lead to this type of error.
Why do you add subviews again and again to your cell's content view.?
That is, for every cellForRowAtIndexpath: call, button will be add to cell. In case dequeueReusableCellWithIdentifier:, your last cell may reuse to any other cell while scroll. It will lead to your error. that is your cell will contain two button.(tag with last cell and tag with your current cell).
In this line [cell.contentView addSubview:tickbtn];, you have to do some change according to add once and also for crossbtn.
Updation: I have seen your updated question. My suggestion, better use custom cell. Use this link to how to create custom cell.. Lot of confusion in your code. ex. in this line UITableViewCell *cell = (UITableViewCell*)[list_table cellForRowAtIndexPath:indexPath];, It will give unexpected. Don't call delegate method like this.
I have a tableview with each cell having eight buttons. I need horizontal scroll to be able to scroll those buttons.
While using this code, i can't see any buttons in cell.
In view did Load
horizontalScroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 270, 320, 60)];
//horizontal scroll is a property of UIViewController
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
int x = 13;
int y=13;
for (int i = 0; i < 8; i++) {
UIButton *button= [UIButton buttonWithType:UIButtonTypeCustom];
button.frame=CGRectMake(x, 80, 45, 22);
[button setTag:i];
[button setTitle:#"08:30" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setBackgroundColor:[UIColor colorWithRed:234.0/255 green:234.0/255 blue:234.0/255 alpha:1]];
button.titleLabel.font = [UIFont fontWithName:#"Helvetica Neue" size:13.0];
[horizontalScroll addSubview:button];
x +=62;
}
[cell addSubview:horizontalScroll];
}
However , if i do :
[cell addSubview:button];
I can see buttons in cell but cannot scroll them.
Any help would be appreciated !!
Add [horizontalScroll setContentSize:CGSizeMake(height, WidthofyourContents)];
Scroller.contentSize =CGSizeMake([imgArray count]*75, 60);
otherwise,Please try to test with rounded rect buttons,its helpful for identify the problem.
If you want to add horizontal scrollview with in the each tableview cell ,
then you must add the horizontal scroll view with in the tableview cell ,that means add the the horizontal scrollview in "cellForRowAtIndexPath" method.
//
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
int x = 13;
int y=13;
UIScrollView *horizontalScroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 60)];
[horizontalScroll setContentSize:(CGSizeMake(790, 60))];
for (int i = 0; i < 8; i++) {
UIButton *button= [UIButton buttonWithType:UIButtonTypeCustom];
button.frame=CGRectMake(x, 0, 45, 22);
[button setTag:i];
[button setTitle:#"08:30" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setBackgroundColor:[UIColor colorWithRed:234.0/255 green:234.0/255 blue:234.0/255 alpha:1]];
button.titleLabel.font = [UIFont fontWithName:#"Helvetica Neue" size:13.0];
[horizontalScroll addSubview:button];
x +=62;
}
[cell addSubview:horizontalScroll];
}
i m new, i added this code to customize table view with image and button in row
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"ImageOnRightCell";
UILabel *mainLabel, *secondLabel;
UIImageView *photo;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 0.0, 100, 20)];
[button addTarget:self action:#selector(buttonPressedAction:) forControlEvents:UIControlEventTouchUpInside];
[button setTag:1];
[cell.contentView addSubview:button];
photo = [[UIImageView alloc] initWithFrame:CGRectMake(50.0, 0.0, 80.0, 45.0)];
photo.tag = PHOTO_TAG;
photo.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:photo];
}
UIImage *theImage = [UIImage imageNamed:#"man.jpg"];
photo.image = theImage;
return cell;
}
image part coming in row of the table, but not the button .
what is the problem in it please
Try it....
UIButton *finalPriceBtn=[UIButton buttonWithType:UIButtonTypeCustom];
finalPriceBtn.tag=i+200;
finalPriceBtn.frame = CGRectMake(100, 0.0, 100, 20);
[finalPriceBtn addTarget:self action:#selector(goBtnClk:) forControlEvents:UIControlEventTouchUpInside];
finalPriceBtn.titleLabel.font=[UIFont systemFontOfSize:12];
[finalPriceBtn setTitle:[NSString stringWithFormat:#"$%.2f",tempVal] forState:UIControlStateNormal];
[finalPriceBtn setTitleColor:[UIColor colorWithRed: 2.0f/255.0f green: 155.0f/255.0f blue: 213.0f/255.0f alpha:1] forState:UIControlStateSelected];
[finalPriceBtn setTitleColor:[UIColor colorWithRed: 2.0f/255.0f green: 155.0f/255.0f blue: 213.0f/255.0f alpha:1] forState:UIControlStateNormal];
finalPriceBtn.titleLabel.textAlignment=UITextAlignmentLeft;
[cell.contentView addSubview:finalPriceBtn];
Hope i helped.
You are adding the button and then adding the image, therefore the image is on top of the button, do this:
[cell.contentView addSubview:photo];
Before this:
[cell.contentView addSubview:button];
You are adding image above your button so add it below the button.
Use your code like this :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"ImageOnRightCell";
UILabel *mainLabel, *secondLabel;
UIImageView *photo;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
photo = [[UIImageView alloc] initWithFrame:CGRectMake(50.0, 0.0, 80.0, 45.0)];
photo.tag = PHOTO_TAG;
photo.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:photo];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(100, 0.0, 100, 20);
[button setBackgroundColor:[UIColor redColor]];// Here add some background color to check its visibility
[button addTarget:self action:#selector(buttonPressedAction:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:button];
}
UIImage *theImage = [UIImage imageNamed:#"man.jpg"];
photo.image = theImage;
return cell;
}
I have a UITableView with 20 rows. In each row, two UIButtons are added, so totally I have 40 buttons. How can I access each button in each cell? All those UIButton have the two tags 1 and 2.
For example: I want to write a method to change the background color of 2 buttons in a particular row:
-(void)changeColor:(int)row{
//code here
}
Do you have any suggestion?
-(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:#"Cell"];
if (cell == nil){
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:#"Cell"] autorelease];
UIButton *button1=[[UIButton alloc] initWithFrame:CGRectMake(x1,y1,w1,h1)];
UIButton *button2=[[UIButton alloc] initWithFrame:CGRectMake(x2,y2,w2,h2)];
[button1 setTag:1];
[button2 setTag:2];
[[cell contentView] addSubview:button0 ];
[[cell contentView] addSubview:button1 ];
[button0 release];
[button1 release];
}
UIButton *button1 = (UIButton *)[cell viewWithTag:1];
UIButton *button2 = (UIButton *)[cell viewWithTag:2];
return cell;
}
You should be able to do this:
-changeColor:(int)row
{
NSIndexPath indexPath = [NSIndexPath indexPathForRow:row inSection:0]; // Assuming one section
UITableViewCell *cell = [myTableView cellForRowAtIndexPath:indexPath];
UIButton *button1 = (UIButton *)[[cell contentView] viewWithTag:1];
UIButton *button2 = (UIButton *)[[cell contentView] viewWithTag:2];
}
*some syntax might be wrong. I dont have Xcode handy
If you want to change the button color to have a highlighted / downstate I suggest to use the following:
[yourButton addTarget:self action:#selector(goToView:) forControlEvents:UIControlEventTouchUpInside];
[yourButton addTarget:self action:#selector(changeColor:) forControlEvents:UIControlEventTouchDown];
[yourButton addTarget:self action:#selector(touchCancel:) forControlEvents:UIControlEventTouchDragExit];
-(void)buttonAction:(UIButton*)sender
{
[self touchCancel:sender];
/* DO SOME MORE ACTIONS */
}
-(void)changeColor:(UIButton*)sender
{
sender.backgroundColor = [UIColor redColor];
}
-(void)touchCancel:(UIButton*)sender
{
sender.backgroundColor = [UIColor clearColor];
}
If you want to make the button have a different selected color, create an array that holds all the selected states. Then use the array to check if the button color needs a different color in cellForRowAtIndexPath.
When you want to change the button color just change the value in the array and call
[self.tableView reloadData];
Be sure to do it outside the if (cell == nil) method so it is also called when the cell is reused.
I've tried a bunch of stuff - adding a button from the object browser, changing attributes, searching the web, but no luck. Essentially, I'd like to do --in the storyboard--:
where you see "add to contacts" "share location" and "add to bookmarks".
You should create a UITableViewCell whose contentView holds 3 separate UIButtons.
To do this programmatically, in your tableView:cellForRowAtIndexPath: data source method, you can use code similar to the following:
- (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* identifier = #"cell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
cell.backgroundColor = [UIColor clearColor];
UIButton* button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
UIButton* button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
UIButton* button3 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame = UIEdgeInsetsInsetRect(cell.contentView.bounds, UIEdgeInsetsMake(0, 0, 0, 250));
button2.frame = UIEdgeInsetsInsetRect(cell.contentView.bounds, UIEdgeInsetsMake(0, 125, 0, 125));
button3.frame = UIEdgeInsetsInsetRect(cell.contentView.bounds, UIEdgeInsetsMake(0, 250, 0, 0));
button1.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
button2.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
button3.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
[cell.contentView addSubview:button1];
[cell.contentView addSubview:button2];
[cell.contentView addSubview:button3];
}
return cell;
}
Also, in the tableView:willDisplayCell: method of your delegate, do the following to have the default decoration of the cell totally disappear:
- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundView = nil;
}
You should obtain a result very similar to what you posted.
Put the three buttons in a UIView that is 320 pixels wide and say 60 hight, and make that view the footer of your table.
The UITableView is styled using the UITableViewStyleGrouped stye.
The three UIButtons are programmatically added to the tableView.tableFooterView.
Alternatively, you can add three UIButtons to the contentView of the last cell.
Add buttons like:
UIButton *theButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
theButton.frame = CGRectMake(20, 20, 200, 40);
[theButton setTitle:#"Button" forState:UIControlStateNormal];
[theButton addTarget:self action:#selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:theButton];
Get the button positions correctly using trial and error :)