欢迎来到天天文库
浏览记录
ID:34652800
大小:200.76 KB
页数:23页
时间:2019-03-08
《Introduction to Drag and Drop - Apple Inc_.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、NextIntroductiontoDragandDropCocoagivesyoutheabilitytoimplementsophisticateddrag-and-dropcapabilitiesbothwithinyourapplicationandbetweenapplications.Thisprogrammingtopicdescribeshowyoucanimplementdrag-and-dropwithjustafewmethods.OrganizationofThisDocumentInthetexthereandinthedraggingprotocold
2、escriptions,thetermdraggingsessionistheentireprocessduringwhichanimageisselected,dragged,released,andabsorbedorrejectedbythedestination.Adraggingoperationistheactionthatthedestinationtakesinabsorbingtheimagewhenitisreleased.Thedraggingsourceistheobjectthat“owns”theimagethatisbeingdragged;itis
3、specifiedasanargumenttothemethodthatinstigatesthedraggingsession.Draggingisavisualphenomenon.Tobethesourceordestinationofadraggingoperation,anobjectmustrepresentaportionofscreenrealestate;thus,onlywindowandviewobjectscanbethesourcesanddestinationsofdrags.(Notethatthesourceviewisnotnecessarilyt
4、hesameobjectsasthedraggingsourcedefinedabove.)NSWindowandNSViewprovidemethodsthathandletheuserinterfacefordragginganobject.YouonlyneedtoimplementafewmethodsfromeithertheNSDraggingSourceorNSDraggingDestinationprotocol,dependingonwhetheryourwindoworviewsubclassisthesourceordestination.Thedraggin
5、gprotocolsaredescribedinthesearticles:•“DraggingSources”•“DraggingDestinations”Howtoreceiveadragisdescribedinthesearticles:•“ReceivingDragOperations”•“DraggingFiles”Draggingsupportintableviewsisdescribedinthisarticle:•UsingDragandDropinTablesCommonly-askedquestionsaboutdrag-and-dropareaddress
6、edinthisarticle:•“FrequentlyAskedQuestions”Next©2012AppleInc.AllRightsReserved.(Lastupdated:2012-01-09)Didthisdocumenthelpyou?YesIt'sgood,but...Nothelpful...NextPreviousDraggingSourcesAdraggingsessionisinitiatedbytheuserclickingthemouseinsideawindoworviewandmovingthemouse.NSViewandNSWindowimp
7、lementthemethoddragImage:at:offset:event:pasteboard:source:slideBack:tohandlethedraggingsession.YouinvokethismethodinthemouseDown:ormouseDragged:methodofyoursubclassofNSVieworNSWindow.Youprovideanimagetodisplayduringthedrag,apasteboardholding
此文档下载收益归作者所有