iOS NSAttributedString rounded background with color

I would like to create something similar as seen on this image:

I managed to create evertyhing with NSMutableAttributedString, except the orange rounded rectangle. I can set the background to that color with BackgroundColor, but I can't find a way to make it rounded. Any samples how can I achieve this? I found this answer, but I can't make it work in Monotouch: NSAttributedString background color and rounded corners

My code in Xamarin.iOS:

var stringBuilder = new NSMutableAttributedString();
stringBuilder.Append(new NSAttributedString("26"));
stringBuilder.SetAttributes(new UIStringAttributes(){BackgroundColor = UIColor.Orange}, new NSRange(stringBuilder.Length - appendString.Length, appendString.Length));
label.AttributedText = stringBuilder;

Answers


I achieved this by making it in a separate UILabel, you can use this code if thats the way you wanna go:

myLabel.layer.cornerRadius = 8;

Need Your Help

Write log from applet, while debugging in eclipse

java file-io applet japplet

I am trying to write a log file from an applet.

How to handle situation with IAP internet loss

ios networking in-app-purchase

I have one button in my app, which is supposed to show the price of item, then if you tap on it you can buy an item. Initially that button is disabled and has no price on it. After application is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.