views:

471

answers:

3

Hello,

I have a UITabeView with some sections and rows.

I want to simulate the Delete Button that appear when you are editing the Contacts, a red button (the size of the cell).

Should I use a button for this ? I've tried to add a background image for the button but I can't 'repeat' it, maybe I have to create one with the final size.

I can change the background color of the cell but would be a 'solid' color ...

What's the best option ?

thanks,

r.

+1  A: 

I would see this question. It should help you with your question. In fact the two questions are the same.

Jaba
yes, it's similar, I'm using another approach now that works in the simulator but not in the device, I'll post here the code once it's valid ...thanks,r.
mongeta
ok, it's solved, it was a case sensitive problem with the picture name, didn't know that iPhone is 'case sensitive' ...regards,r,
mongeta
A: 

I'm using this code, in the simulator I get a cell with a big red button (the same size as the cell) with the title Delete Ingredient. I can click and the event is fired. Perfect.

In the device, an iPhone 3G, I get the cell with the button with a white background, no picture, nothing red ...

why ????

:-)

thanks,

r.

cell.accessoryType = UITableViewCellAccessoryNone;
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        [button setBackgroundImage: [[UIImage imageNamed: @"redButton.png"] stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0] forState:UIControlStateNormal];
[button setTitle:@"Delete Ingredient" forState:UIControlStateNormal];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
button.frame= CGRectMake(0.0, 0.0, 300, 44);
[cell.contentView addSubview:button];
[button addTarget:self action:@selector(ingredientDeleteAsk) forControlEvents:UIControlEventTouchUpInside];
mongeta
A: 

The problem was a case sensitive.

The Simulator it's NOT case sensitive, but the iPhone it is ...

thanks,

r.

mongeta