objective c - Popover segue from NSCollectionViewItem -
tl;wr
what best way popover-segue cloned view (nscollectionviewitem)?
good afternoon,
i'm trying figure out how segue itemprototype, it's not straight-forward hoping, , has tripped up, somewhat.
i've got nscollectionview, variable number of nscollectionviewitems, each button. hoping i'd need do, segue button small information window, connect window button via popover segue, luck have it, that's not how done.
i'm assuming because button on nscollectionviewitem prototype cloned populate nscollectionview, it's passing mixed messages segue, when it's being called. specifically, i'm receiving following error when press 1 of buttons.
*** assertion failure in -[producttile presentviewcontroller:animator:], /sourcecache/appkit/appkit-1348.11/controllers/nsviewcontroller.m:815 presentviewcontroller:animator:: view '<producttile: 0x610000100ea0>{represented object: (null), view: <nsview: 0x6100001208c0> (frame {{0, 0}, {346, 216}}), selected: no}''s view not in window/view hierarchy. ( 0 corefoundation 0x00007fff9688c03c __exceptionpreprocess + 172 1 libobjc.a.dylib 0x00007fff8dea576e objc_exception_throw + 43 2 corefoundation 0x00007fff9688be1a +[nsexception raise:format:arguments:] + 106 3 foundation 0x00007fff880408cb -[nsassertionhandler handlefailureinmethod:object:file:linenumber:description:] + 195 4 appkit 0x00007fff8c10413c -[nsviewcontroller presentviewcontroller:animator:] + 535 5 appkit 0x00007fff8c10447f -[nsviewcontroller presentviewcontroller:aspopoverrelativetorect:ofview:preferrededge:behavior:] + 169 6 appkit 0x00007fff8c3bf75a -[nsstoryboardpopoversegue perform] + 402 7 libsystem_trace.dylib 0x00007fff9451acd7 _os_activity_initiate + 75 8 appkit 0x00007fff8be33fc1 -[nsapplication sendaction:to:from:] + 452 9 appkit 0x00007fff8be49a56 -[nscontrol sendaction:to:] + 86 10 appkit 0x00007fff8be49972 __26-[nscell _sendactionfrom:]_block_invoke + 131 11 libsystem_trace.dylib 0x00007fff9451acd7 _os_activity_initiate + 75 12 appkit 0x00007fff8be498cf -[nscell _sendactionfrom:] + 144 13 libsystem_trace.dylib 0x00007fff9451acd7 _os_activity_initiate + 75 14 appkit 0x00007fff8be47dc3 -[nscell trackmouse:inrect:ofview:untilmouseup:] + 2821 15 appkit 0x00007fff8bea045f -[nsbuttoncell trackmouse:inrect:ofview:untilmouseup:] + 770 16 appkit 0x00007fff8be46476 -[nscontrol mousedown:] + 714 17 appkit 0x00007fff8c3b030c -[nswindow _reallysendevent:isdelayedevent:] + 14125 18 appkit 0x00007fff8bd3fd96 -[nswindow sendevent:] + 470 19 appkit 0x00007fff8bd3c322 -[nsapplication sendevent:] + 2504 20 appkit 0x00007fff8bc65c78 -[nsapplication run] + 711 21 appkit 0x00007fff8bbe2354 nsapplicationmain + 1832 22 kimochi client 0x0000000100006b62 main + 34 23 libdyld.dylib 0x00007fff939715c9 start + 1 24 ??? 0x0000000000000003 0x0 + 3 )
primarily, i'm getting sense of dread. also, don't think likes clones (must on dark side).
i have been looking alternatives creating popover segue via storyboard, looks may not common problem (either that, or i'm still not used relatively small amount of developers os x).
specifically, question is: how "do" popover segue itemprototype? i'm okay doing programatically, haven't written gui-code in objective c before, i'd know segue possible, before try figure out. don't want end pulling hair out, due technical impossibility.
thanks taking time read this! appreciate information can give me, , please let me know if provide more details, make question more clear.
michael
edit [2015-05-15 18:59]
to illustrate i'm asking, bellow 2 images; example of collection view, , example of popover segue i'd apply items in collection view. hope helpful, although can see how might confusing, please let me know if have questions.
edit [2015-05-15 19:08]
the above 2 pictures don't enough explain i'm hoping achieve, following representation of end goal. clarify everything.
michael
storyboards relatively new os x. nscollectionview
seems not love apple. there have been numerous reports combination of nscollectionview
, storyboards buggy. so, may better off doing non-storyboard way.
it may simplest connect button action method on view controller. in action method, can use sender
parameter identify button and, there, collection view item.
you can open pop-over window. instantiate view controller load pop-over content view nib (i.e. [[myviewcontroller alloc] initwithnibname:@"mypopovercontentview" bundle:nil]
). you'd set view controller's representedobject
. you'd create nspopover
, set contentviewcontroller
view controller , configure other properties. then, you'd present using -showrelativetorect:ofview:preferrededge:
. you'd show relative either sender
or 1 of ancestor views within collection view item view.
Comments
Post a Comment