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.
Try checking if the button's frame
is equal to CGRectZero
and if so, set it to an appropriate value.