I'm trying to create a custom table view cell 开发者_高级运维that has a button on the right hand side, such that I can click that button and do something different than when I click the regular cell. The problem right now is that on the top cell, where the cell should be rounded, the button is not getting cut off (see picture). I've heard of the view.clipsToBounds property, but I guess I'm not entirely sure how to go about implementing in my custom UITableViewCell class. Thanks for the help!
You could use a image as background, the image must have the right-high corner rounded. Then use the follow code:
UIImage *corner = [UIImage imageWithContentsOfFile:@"/path/to/image"]; //Or imageNamed:@"image"
purpleButton1.setBackgroundImage:corner forState:UIControlStateNormal];
That should work.
精彩评论