Iphone UIButtonyPeroundRect作为附件视图
我有一个表视图,我想在每个单元格的右侧放置一个标签,因此在Iphone UIButtonyPeroundRect作为附件视图,iphone,objective-c,uitableview,accessoryview,Iphone,Objective C,Uitableview,Accessoryview,我有一个表视图,我想在每个单元格的右侧放置一个标签,因此在-(UITableViewCell*)tableView:(UITableView*)tableView cell for rowatinedexpath:(nsindepath*)indepath中,我有一些这样的代码 UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.titleLabel.text = @"title"; cell.
-(UITableViewCell*)tableView:(UITableView*)tableView cell for rowatinedexpath:(nsindepath*)indepath
中,我有一些这样的代码
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.titleLabel.text = @"title";
cell.accessoryView = button;
但是,该按钮根本不显示。有人知道为什么吗?
我确信声明是正确的,因为如果我将按钮声明替换为
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
然后按钮出现,这使我认为圆角矩形也应该出现。尝试检查按钮的
帧是否等于CGRectZero
,如果是,将其设置为适当的值