UIButtonTypeRoundedRect as an accessoryView

Posted by phunehehe on Stack Overflow See other posts from Stack Overflow or by phunehehe
Published on 2010-05-28T10:31:55Z Indexed on 2010/05/28 10:51 UTC
Read the original article Hit count: 555

Hello,

I have a table view and I want to put a label on the right of each cell, so in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath I'm having some code like this

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.titleLabel.text = @"title";
cell.accessoryView = button;

However, the button is not displaying at all. Anyone know why? I am sure that the declaration is correct, because if I replace the button declaration with

UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

then the button appears, which make me think that the rounded rectangle should also appear.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c