有一个难以理解的问题。我在视图控制器中有一个 ShinobiGrid 视图。尝试将网格居中在网格(列)的中间
spreadSheet.SetContentOffset(new PointF(200, 0), true);
通过这样做,我得到一个运行时异常并且我不理解它(因为我不是一个 Objective-C 程序员)。这是怎么回事?
{MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.
Name: NSRangeException Reason: *** -[__NSArrayM insertObject:atIndex:]:
index 1 beyond bounds for empty array at (wrapper managed-to-native)
MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_PointF_bool
(intptr,intptr,System.Drawing.PointF,bool) at
MonoTouch.UIKit.UIScrollView.SetContentOffset
(PointF contentOffset, Boolean animated) [0x00027] in
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIScrollView.g.cs:210 at
Roombler.Gui.IPad.ViewControllers.RoomblerViewController.ViewDidLoad () [0x0011c] in
/Users/jonas/Documents/Roombler/BitBucket/Roombler.Gui/Roombler.Gui.IPad/ViewControllers/RoomblerViewController.cs:97
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend
(intptr,intptr) at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:124 at
Roombler.Gui.IPad.ViewControllers.AppDelegate.FinishedLaunching
(MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options)
[0x00031] in
/Users/jonas/Documents/Roombler/BitBucket/Roombler.Gui/Roombler.Gui.IPad/ViewControllers/AppDelegate.cs:29
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain
(int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[]
args, System.String principalClassName, System.String delegateClassName) [0x0004c] in
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 at
Roombler.Gui.IPad.Application.Main (System.String[] args) [0x00000] in
/Users/jonas/Documents/Roombler/BitBucket/Roombler.Gui/Roombler.Gui.IPad/Main.cs:17 }