Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't set CATiledLayer.FadeDuration in MonoTouch
    primarykey
    data
    text
    <p>I'm trying to remove fading animation from <code>CATiledLayer</code>. </p> <p>Setting <code>CATiledLayer.FadeDuration</code> static property doesn't work and is not supposed to, according to this closed bug report: <a href="https://bugzilla.novell.com/show_bug.cgi?id=648993" rel="nofollow noreferrer">https://bugzilla.novell.com/show_bug.cgi?id=648993</a></p> <p>The suggested solution in Objective-C is to subclass <code>CATiledLayer</code>: <a href="https://stackoverflow.com/questions/1073727/how-to-change-iphone-catiledlayer-fadeduration">How to change iphone CATiledLayer fadeDuration?</a>. I've implemented this in MonoTouch but nothing is being drawn in the view, although <code>DrawInContext</code> is called as expected. </p> <p>The complete code to reproduce the problem is below. As soon as I remove <code>[Export("fadeDuration")]</code> everything works (but with animation). </p> <p>Thanks in advance for any help.</p> <pre><code>using System; using System.Drawing; using MonoTouch.CoreAnimation; using MonoTouch.UIKit; using MonoTouch.Foundation; using MonoTouch.ObjCRuntime; [Register("NoFadeTiledLayer")] public class NoFadeTiledLayer : CATiledLayer { public NoFadeTiledLayer () : base() {} public NoFadeTiledLayer (IntPtr handle) : base(handle) {} public override void DrawInContext (MonoTouch.CoreGraphics.CGContext ctx) { // This is being called everytime base.DrawInContext (ctx); } [Export("fadeDuration")] public static new double FadeDuration () { return 0; } } public class ContentView : UIView { [Export("layerClass")] public static Class LayerClass () { return new Class (typeof(NoFadeTiledLayer)); } public override void Draw (RectangleF rect) { DrawString ("Lorem ipsum", rect, UIFont.SystemFontOfSize (15)); } } [Register("AppDelegate")] public class AppDelegate : UIApplicationDelegate { static void Main (string[] args) { UIApplication.Main (args, null, "AppDelegate"); } public override bool FinishedLaunching (UIApplication app, NSDictionary options) { var window = new UIWindow (UIScreen.MainScreen.ApplicationFrame); window.BackgroundColor = UIColor.Green; var view = new ContentView (); view.BackgroundColor = UIColor.White; view.Frame = window.Bounds; window.AddSubview (view); window.MakeKeyAndVisible (); return true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload