本文将为您提供关于objective-c–NSCollectionViewItem双击动作?的详细介绍,我们还将为您解释双击事件需要如何触发的相关知识,同时,我们还将为您提供关于ARObjectCol
本文将为您提供关于objective-c – NSCollectionViewItem双击动作?的详细介绍,我们还将为您解释双击事件需要如何触发的相关知识,同时,我们还将为您提供关于ARObjectCollectionViewController、Cocoa – NSCollectionView和NSCollectionViewItem之间的链接在哪里? Xcode 6 Bug?、cocoa – 在NSCollectionView中双击、collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object的实用信息。
本文目录一览:- objective-c – NSCollectionViewItem双击动作?(双击事件需要如何触发)
- ARObjectCollectionViewController
- Cocoa – NSCollectionView和NSCollectionViewItem之间的链接在哪里? Xcode 6 Bug?
- cocoa – 在NSCollectionView中双击
- collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object
objective-c – NSCollectionViewItem双击动作?(双击事件需要如何触发)
谢谢
解决方法
ARObjectCollectionViewController
ARObjectCollectionViewController 介绍
ARObjectCollectionViewController 是 UIViewController,可以展示 JSON Nsstring,JSON
NSData, JSON URL, XML NSData, XML URL, RSS NSData, RSS URL, NSDictionary,
NSArray, NSSet, UIImage EXIF 元数据等等。
ARObjectCollectionViewController 官网
http://www.alexruperez.com/repos/25-arobjectcollectionviewcontroller
Cocoa – NSCollectionView和NSCollectionViewItem之间的链接在哪里? Xcode 6 Bug?
想象一下,我将几个NScollectionView拖到同一个视图中。我会有一堆NSCollectionViewItems。集合视图如何知道哪个NScollectionViewItem属于它?在界面构建器上可以看到两者之间有连接吗?我在界面构建器上看不到任何东西我该怎么办?
编辑:显然这似乎是一个Xcode的bug。当您将NSCollectionView添加到故事板时,它没有指向NSCollectionViewItem的链接,并且似乎无法在它们之间连接itemPrototype插座。
在联系苹果之后,他们的回答是:“这是OS X上的Storyboards的一个知识问题,而是使用Xibs。”我对你的建议是:永远不要使用与OS X的故事板。事情是半熟的,充满了错误。
编辑:今天,一年后,Xcode 7.1仍然存在这个bug。建议仍然有效。不要在您的OS X应用程序中使用故事板,直到苹果在未来10年内修复它
解决方法
@IBOutlet weak var collectionView: NSCollectionView! override func viewDidLoad() { // don't forget to set identifier of CollectionViewItem // from interface builder let itemPrototype = self.storyboard?.instantiateControllerWithIdentifier("collectionViewItem") as NSCollectionViewItem self.collectionView.itemPrototype = itemPrototype }
cocoa – 在NSCollectionView中双击
h文件:
@interface IconViewBox : NSBox { IBOutlet id delegate; } @end
m文件:
@implementation IconViewBox -(void)mouseDown:(NSEvent *)theEvent { [super mouseDown:theEvent]; // check for click count above one,which we assume means it's a double click if([theEvent clickCount] > 1) { NSLog(@"double click!"); if(delegate && [delegate respondsToSelector:@selector(doubleClick:)]) { NSLog(@"Runs through here"); [delegate performSelector:@selector(doubleClick:) withObject:self]; } } }
第二个NSLog永远不会被打印,因为委托是空的.我已经连接了我的nib文件中的所有内容并按照说明操作.有谁知道为什么或替代为什么这样做?
解决方法
>子类NSView并添加一个mouseDown:方法来检测多次点击
>将nib中的NSCollectionItem视图从NSView更改为MyCollectionView
>在关联的NSWindowController中实现collectionItemViewDoubleClick:
这可以通过让NSView子类检测到双击并传递响应者链来实现.调用响应器链中实现collectionItemViewDoubleClick:的第一个对象.
通常,您应该在关联的NSWindowController中实现collectionItemViewDoubleClick:,但它可以位于响应程序链中的任何对象中.
@interface MyCollectionView : NSView /** Capture double-clicks and pass up responder chain */ -(void)mouseDown:(NSEvent *)theEvent; @end @implementation MyCollectionView -(void)mouseDown:(NSEvent *)theEvent { [super mouseDown:theEvent]; if (theEvent.clickCount > 1) { [NSApplication.sharedApplication sendAction:@selector(collectionItemViewDoubleClick:) to:nil from:self]; } } @end
collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object
类型转换为ID解决问题: “Collection element of type ''CGColorRef'' (aka ''struct CGColor *'') is not an Objective-C object”
编译器理解Objective-C方法返回的核心基础类型遵循历史可命名约定(见-高级内存管理编程指南)。例如,编译器知道,在iOS的cgcolor返回用UIColor的cgcolor方法不拥有。您必须仍然使用一个合适的类型转换,
1down voteaccepted |
It is documented in the "Transitioning to ARC Release Notes":
|
参考:http://stackoverflow.com/questions/21933209/why-type-cast-to-id-will-get-rid-of-this-error-message-collection-element-of-ty
我们今天的关于objective-c – NSCollectionViewItem双击动作?和双击事件需要如何触发的分享就到这里,谢谢您的阅读,如果想了解更多关于ARObjectCollectionViewController、Cocoa – NSCollectionView和NSCollectionViewItem之间的链接在哪里? Xcode 6 Bug?、cocoa – 在NSCollectionView中双击、collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object的相关信息,可以在本站进行搜索。
本文标签: