自定义UIButton与图像

Idr*_*raf 3 iphone uibutton uitableview ios

我正在尝试设置细胞的辅助视图UIButton.但它没有显示.

这是代码

UIButton *accessory = [UIButton buttonWithType:UIButtonTypeCustom];
[accessory setImage:[UIImage imageNamed:@"plus.png"] forState:UIControlStateNormal];
[cell setAccessoryView:accessory];
Run Code Online (Sandbox Code Playgroud)

gra*_*ver 6

[accessory sizeToFit];根据图像调整其大小.