c# - Strange behaviour when initialising UISegmentedControl -
i'm writing monotouch app , i'm trying add uisegmentedcontrol view (programmatically not through ib). kept receiving following error message:
application windows expected have root view controller @ end of application launch
this strange because uisegmentedcontrol has nothing window root view controller. in end reduced code way down initialisation of variable:
// code appears in class inherits uiview var segmentedcontrol = new uisegmentedcontrol ();
i've tried putting code in class inherits uiviewcontroller , same behaviour occurred. tried putting appdelegate still same error displayed.
note: debugging on ipad device when running code
after playing around commented out random uiviewcontroller class have , app ran fine. i've tried commenting out various different uiviewcontrollers , every time runs fine there's not 1 view controller seems problem. it's if i've hit sort of limit amount of view controllers can have.
is possible? , if not might problem be?
p.s. may related previous issue raised here: error when adding uitabbarcontroller
edit
inside finishedlaunching method have code:
_window = new uiwindow(uiscreen.mainscreen.bounds); _window.rootviewcontroller = _navigationcontroller; _window.makekeyandvisible();
i running in ios version 6.1.
i've since tried commenting out class not 1 inherits uiviewcontroller, , app runs fine. perhaps memory issue
edit 2
i tried removing view , controller being affected , built them again , drilled down when view inherits uiview. if have code in uiviewcontroller , class used uiview (but not inherit it) app runs without problem. inherit class uiview error message described above.
that error not related uisegmentedcontrol
. please check whether mentioned application's rootview in code. if not it.
in finishedlaunching
method add:
if (uidevice.currentdevice.checksystemversion (5, 0)) { window.rootviewcontroller = yourviewcontroller; } else { window.addsubview (yourviewcontroller.view); }
Comments
Post a Comment