[MonoTouch] Object reference not set exception when calling UIView.Animate

technohead dj_technohead at yahoo.com
Fri Mar 16 23:21:28 UTC 2012


Was playing around with a card game that I'm building, when I decided to try
dragging a card off the visible screen... behind a header. The code
recognizes this as an invalid move and animates the card back to its
original location, but this throws the above error. The stack trace looks as
follows:

Object reference not set to an instance of an object
at MonoTouch.UIKit.UIView+<Animate>c__AnonStorey12.<>m__14 (Boolean x)
[0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIView.cs:103
\n  at MonoTouch.UIKit.UIView.TrampolineUICompletionHandler (IntPtr block,
Boolean finished) [0x0004d] in
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIView.g.cs:1590 \n  at
(wrapper native-to-managed)
MonoTouch.UIKit.UIView:TrampolineUICompletionHandler (intptr,int)\n  at
(wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain
(int,string[],intptr,intptr)\n  at MonoTouch.UIKit.UIApplication.Main
(System.String[] args, System.String principalClassName, System.String
delegateClassName) [0x00042] in
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 \n  at
CardGame.Application.Main (System.String[] args) [0x00000] in
/Users/dj_technohead/Projects/Teraport/Monotouch/CardGame/CardGame
Lite/Main.cs:20

The code in particular that ends up causing the exception is:

UIView.Animate(0.5f, ()=>{
                        this.Frame = new RectangleF(originalLocation,
this.Image.Size);
                    });

and the value of this.Frame before execution of the animation is:
{{X=267,Y=-61,Width=38,Height=54}}

Any ideas why it's throwing this error?

thanks,
Dennis


--
View this message in context: http://monotouch.2284126.n4.nabble.com/Object-reference-not-set-exception-when-calling-UIView-Animate-tp4479639p4479639.html
Sent from the MonoTouch mailing list archive at Nabble.com.


More information about the MonoTouch mailing list