uisplitviewcontroller - iPad UISplitView Detail Toolbar NULL on Startup -


i've been racking brain trying figure out little bug in ipad half of app i'm working on. it's related problem in post:

ipad splitviewcontroller strange behaviour

actually, should it's same problem. however, solution given there won't work me, since app has main menu swaps on uisplitviewcontroller's view when proper button pressed. controller , contained view controllers aren't created until button press. thus, can't set controller's delegate before calling [window makekeyandvisible], since that's done way when main menu loads.

now, i've added nslog calls delegate's willhideviewcontroller function follows:

nslog(@"will hide popover view controller!"); nslog(@"self=%p",self); nslog(@"%@",detailpad.tbtoolbar); 

when start app on ipad in portrait mode, , click switch on split view controller, delegate's willhideviewcontroller indeed called, when finishes, i'm left empty toolbar in detail view. strange part that third nslog call, should output info detail view controller's toolbar, spits out (null) instead. made stranger fact preceding code sets toolbar's items, , code doesn't cause single exception raised, though toolbar apparently doesn't exist.

[session started @ 2011-02-23 16:16:59 -0500.]   2011-02-23 16:17:02.626 test[33835:207] hide popover view controller!   2011-02-23 16:17:02.628 test[33835:207] self=0x5351bc0   2011-02-23 16:17:02.629 test[33835:207] (null)   2011-02-23 16:17:14.487 test[33835:207] hide popover view controller!   2011-02-23 16:17:14.488 test[33835:207] self=0x5351bc0   2011-02-23 16:17:14.490 test[33835:207] <uitoolbar: 0x56201a0; frame = (0 0; 703 44); autoresize = w+bm; layer = <calayer: 0x5620260>>   2011-02-23 16:24:52.158 test[33835:207] hide popover view controller!   2011-02-23 16:24:52.159 test[33835:207] self=0x5351bc0   2011-02-23 16:24:52.160 test[33835:207] <uitoolbar: 0x56201a0; frame = (0 0; 703 44); autoresize = w+bm; layer = <calayer: 0x5620260>> 

as can see, subsequent logs show toolbar alive , well, , know calls coming same object in cases. these later calls came rotating landscape , portrait, it's same detail view controller well.

so question this: cause toolbar come null first time, work after doing nothing rotating ipad, , can fix it?

thanks in advance, ryan

and... found workaround. had master view controller set split view controller's delegate, fine. however, first time willhideviewcontroller called happens before detail view has been set up; that's why toolbar doesn't exist yet. moved several things on detail controller, , made delegate instead. then, in addition setting toolbar's items in willhideviewcontroller, set them in viewdidload. detail view controller hands popover button , controller master view controller, since master needs able create new detail view controllers , assign them popover button (i neglected mention before detail view controllers pushed , popped navigation controller).

it ain't pretty, works.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -