这是我的情况,我有UILable固有的自定义控件 我需要创建拍摄图像的方法(来自代码或故事板) 要添加到我的标签
我尝试将此代码转换为Xamarin.iOS Source
<button id="movies">Movies</button>
<button id="animals">Animals</button>
任何人都可以帮助我
答案 0 :(得分:2)
试试这个:
public void SetLeftDrawable (UIImage image)
{
var attachment = new NSTextAttachment ();
attachment.Image = image;
var attachmentString = NSAttributedString.FromAttachment (attachment);
//replace "price" with your string.
var myString = new NSMutableAttributedString ("price");
myString.Append (attachmentString);
AttributedText = myString;
}
希望这会有所帮助.-