您的位置:首页 > 其它

设置mac应用程序图标

2011-03-04 15:31 253 查看
//获取束路径

NSString *strBundlePath = [[NSBundle mainBundle] bundlePath];

//获取目录

NSString * strBundleDir = [strBundlePath stringByDeletingLastPathComponent];

//合成图标资源的全路径

NSString *strIconPath = [strBundleDir stringByAppendingPathComponent:@"app.ico"];

//读取图标文件

NSImage *myAppIcon = [[NSImage alloc] initWithContentsOfFile: strIconPath];

//得到当前的主程序

NSApplication *currentApp = [NSApplication sharedApplication];

//设置程序图标

[currentApp setApplicationIconImage: myAppIcon];

//释放资源

[myAppIcon release];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: