Last active
August 29, 2015 14:02
-
-
Save svrooij/21a9430cfdce879155ba to your computer and use it in GitHub Desktop.
Use tinted images in MonoTouchDialog ImageStringElement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
using MonoTouch.Dialog; | |
namespace FhictPhoto | |
{ | |
public partial class TintedImageDialog : DialogViewController | |
{ | |
public TintedImageDialog () : base (UITableViewStyle.Grouped, null) | |
{ | |
Root = new RootElement ("TintedImageDialog") { | |
new Section ("First Section") { | |
new TintImageStringElement("Title",UIImage.FromBundle("Images/sample.png")){TintColor = UIColor.Red} | |
}, | |
}; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MonoTouch.UIKit; | |
namespace MonoTouch.Dialog | |
{ | |
public class TintImageStringElement : ImageStringElement | |
{ | |
public UIColor TintColor { get; set; } | |
public TintImageStringElement (string caption, UIImage image):base(caption,image.ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate)) | |
{ | |
TintColor = UIColor.FromRGB (102, 51, 102); | |
} | |
public override UITableViewCell GetCell (UITableView tv) | |
{ | |
var cell = base.GetCell (tv); | |
cell.ImageView.TintColor = TintColor; | |
return cell; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment