现在我想在我的应用程序运行时隐藏或显示我的条件分隔符.使用此委托方法:
- (BOOL)splitView:(NSSplitView *)splitView shouldHideDividerAtIndex:(NSInteger)dividerIndex
{
if (A)
return YES;
else
return NO;
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,为什么?如何使用这种方法?非常感谢你!
我正在用可可开发一个flvplayer.我想从finder拖动一个flv文件并将其放到webview窗口(我用它来查看flv).但我没有找到这个文件的路径.这是我的代码:
_ (void)showflv(nsstring*)aa
{
..........
//Register to accept flv drag/drop
NSString *pboardType = NSCreateFileContentsPboardType(@"flv");
NSArray *dragTypes = [NSArray arrayWithObject:pboardType];
[self registerForDraggedTypes:dragTypes];
}
_ (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
if ( [[pboard types] containsObject:NSFileContentsPboardType] ) {
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我阅读了有关this的文档.我发现PerformDragOperation的功能可以这样写:
_ (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
if ( [[pboard types] containsObject:NSFileContentsPboardType] ) {
NSFileWrapper *fileContents = [pboard readFileWrapper];
// Perform operation using the file’s contents
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我可以得到这个拖动文件的文件内容.但是如何获取路径?
NSString *fileName = [fileContents …Run Code Online (Sandbox Code Playgroud) 我想在webview中显示本地图像,怎么办?有人有一个简单的演示?非常感谢!!!
我想使用带参数的命令行来调用我的cocoa app,但是在我的cocoa app中,如何接收参数,这个参数是一个文件路径,非常感谢你!
我想在用户点击文本字段时打开一个面板.我想我应该使用一个响应click事件的委托方法.我发现了
- (void)textDidBeginEditing:(NSNotification *)aNotification
Run Code Online (Sandbox Code Playgroud)
方法不起作用,那个
- (void)controlTextDidBeginEditing:(NSNotification *)aNotification
Run Code Online (Sandbox Code Playgroud)
方法有效,但只有当我在文本字段中编辑文本时,才会单击它.如果我再次编辑文本,此方法不起作用.为什么?
对不起,我想我想在mac上使用它,而不是在iphone上,如何使用cocoa?
在Cocoa中,可以使用该setParentWindow:方法将抽屉附接到窗户.是否可以以某种方式将抽屉连接到视图?
我有一个主页面的应用程序是一个隐藏的导航栏,当我从子页面用导航栏返回到这个主页面时,因为我设置隐藏在主页面中的导航方法: - (void)viewWillAppear,我发现一个黑盒子会出现动画,如何避免呢?非常感谢你!!!
现在我想将我的Project中的图像导出到一个文件夹,我认为这是与NSBundle和NSFileManager问题有关,但我不知道如何处理它?非常感谢!
我想用safari开发一个插件,现在我新建了一个带有bundle的项目.然后我知道如果插件工作,app.webplugin将被放入文件夹:/ Library/internet plugins.但是当我将项目树的Products文件夹中的app.bundle后缀重命名为app.webplugin时,当我重建时,我发现在调试文件夹中app.bundle会再次出现.我看到一些例子,当他们构建时,一些app.plunin或app.webplugin将在调试文件夹中出现,为什么?如果可以直接将app.bundle重命名为Products文件夹中的app.webplugin?非常感谢!
我发现一些程序可以放入仪表板,其中大部分都有一个功能:当点击"i"时,面板将翻转并显示另一个面板,如何实现它?以及如何将程序放入仪表板?非常感谢你!
cocoa ×8
iphone ×2
objective-c ×2
xcode ×2
cocoa-touch ×1
command-line ×1
drawer ×1
ios4 ×1
ios5 ×1
nssplitview ×1
split ×1
uitextfield ×1
webkit ×1