osx - How to show a Default view or simply a white screen when the NSPageController arrangedObjects count goes from one to zero? -


mac app using xcode:7.3 on sierra 10.12.2

i have panel tabview has tab enables adding , deleting photos. there nspagecontroller in book mode allows navigation of photos. arrangedobjects of nspagecontroller contained in mutable array supports addition , deletion of photos. pagecontroller.view nsbox.

_editrecipecontroller.pagecontroller.arrangedobjects = _mutphotoimagearray; 

i writing ask how should handle removal of last remaining photo.

if mutable array has more 1 photo, when click on delete button, photo removed _mutphotoimagearray, , code navigates 1 of remaining photos in pagecontroller.

when delete final photo, want last photo disappear , header "no photos found"

what happens following click on delete button when 1 photo in pagecontroller, photo not disappear, forced display rather kludgy message, "press done button delete final photo."

how make pagecontroller display blank screen?

when want display no images, set arrangedobjects ["empty"] (an array single object of type/value except normal data type).

in pagecontroller(_ pagecontroller: nspagecontroller, identifierfor object: any), guard on object being of data type. if isn't, return identifier of "empty".

in pagecontroller(_ pagecontroller: nspagecontroller, viewcontrollerforidentifier identifier: string), if identifier "empty", return view controller displays "no photos found" view.

i'm not sure if necessary, in pagecontroller(_ pagecontroller: nspagecontroller, didtransitionto object: any) if object "empty", call method reset "empty" array. not sure if necessary, doesn't hurt have 1 guard there.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -