ios - Interface not drawn if becomeCurrentPage is called by a late page -
just sarah said in link: https://forums.developer.apple.com/thread/26922 have same problem using method "becomecurrentpage" when called "presentcontrollerwithnames()" , pages more 5. have watchkit app initial controller creates 15 page interface called using presentcontrollerwithnames(). of these same sub-classed wkinterfacecontroller. depending on context data passed, 1 of first 15 pages call becomecurrentpage() during awakewithcontext() make active page. works fine long 1 of pages later pages, display appears blank. if swipe through pages, nothing appears until page 4 displays after slight pause. after swiping forwards or backwards shows expected displays. debugger can see interface elements have been initialised , can accessed programmatically. not set hidden, not appear.
writing simple test app, have found problem not total number of pages index of page calls becomecurrentpage(). , not consistent between simulator , watch or test test.
in test app, running on simulator, app 30 pages work if page , including 18 made active. activating page 19 work. activating page 20 never work.
with actual watch, numbers lower , more variable: activating page 5 work. activating pages 6 - 10 work. activating page 16 or more never work.
i tried setup page later in method:"didappear" , didn't if want have 10 or 20 pages.
the work-around found involved doing series of jumps forwards through pages each separated delay. found jumping forward 3 pages delay of 0.3 seconds worked time, makes interface terrible takes more second destination page screen flashing intervening pages go.
is known bug becomecurrentpage()? know how deal problem?
calling becomecurrentpage() main thread worked me.
apple documentation mentions calling becomecurrentpage() main thread.
dispatch_async(dispatch_get_main_queue(),{ controller.becomecurrentpage() })
Comments
Post a Comment