I hope to display the badge info on the row UITableView like the picture shown below
I try to use codes below:
UILabel *labelCell1 =[ [UILabel alloc]init];
labelCell1.frame = CGRectMake(160.9f,10.0f,60.0f,30.0f) ;
[labelCell1 setBackgroundColor:[UIColor
colorWithPatternImage:[[UIImage imageNamed:@"block.png"]
stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]]];
but I can not get result of round block shown in the picture above.
You can use the layer to make sure your label has rounded corners like the example. You also need to adjust the rect for the label based on the width of the text:
Throw out your code, don't reinvent the wheel. This has been done by several people who have made it open source. Here is one, here is another.
You can get the following out put using the code in Link