在NSButton上使用-setImage [英] Using -setImage on NSButton
本文介绍了在NSButton上使用-setImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<$> 我想在Cocoa应用程序中创建一个图像按钮(NSButton),下面是我想使用的代码: c $ c> [mrButton setImage:(NSImage *)@button.jpg];
我已经链接mrButton到接口生成器中的NSButton,我有一个文件在我的Xcode项目中叫按钮。
提前感谢!
解决方案
这应该工作: [mrButton setImage:[NSImage imageNamed:@button.jpg]];
/ p>
I am trying to make an image an button (NSButton) in a Cocoa application, below is the code I am trying to use:
[mrButton setImage:(NSImage *)@"button.jpg"];
I have linked mrButton to an NSButton in interface builder and I have a file within my Xcode project called button.jpg and I was wondering how I would go about correcting this code or making an NSButton an image.
Thanks in advance!
解决方案
This should work: [mrButton setImage:[NSImage imageNamed:@"button.jpg"]];
这篇关于在NSButton上使用-setImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文