watch os 2 - WatchOS: Inserting pages in page-based navigation -
i'm using -[wkinterfacecontroller presentcontrollerwithnames:contexts:]
modally present dynamically-created set of pages. there may occasions want insert page in set of pages while visible. possible, or set of pages fixed once visible?
i have devised method achieve this, it's messy. better solution considerable improvement.
- each
wkinterfacecontroller
in group of pages hasuuid
property assigned using context , stored duringawakewithcontext:
- the
wkinterfacecontroller
presents group of pages retains arrays ofwkinterfacecontroller
names , contexts before presenting them - when 1 of pages needs insert/delete pages set, posts notification presenting
wkinterfacecontroller
- the presenting
wkinterfacecontroller
makes changes required in retained arrays ofwkinterfacecontroller
names , contexts - the presenting
wkinterfacecontroller
dismisses current group of pages , re-presents them using updated name/context arrays - the presenting
wkinterfacecontroller
posts notification observed of pages, includinguuid
new page notification object. notification triggers pages check ownuuid
against 1 sent in notification object. if notification matches, interface controller callsbecomecurrentpage
i haven't tested this, it's method can think of might work. ugly though, see current page disappear, first page appear, , new page animate view. not great user experience perspective, can't think of other way since apple doesn't give methods insert pages.
Comments
Post a Comment