小编Ron*_*ann的帖子

NSButton如何为文本着色

在OSX上我有一个非常暗的图像的NSButton,不幸的是,使用属性检查器无法更改颜色.看图片大黑色按钮,文字是Go.

在此输入图像描述

是否有可能改变文字颜色的线索?我查看了NSButton类,但没有方法可以做到这一点.我知道我可以使用白色字体制作图像,但这不是我想要做的.

来自瑞士的问候,罗纳德霍夫曼--- 

macos objective-c textcolor nsbutton

31
推荐指数
5
解决办法
3万
查看次数

文档不在源代码管理下,nib显示为xml文本

从昨天开始,当点击导航器中的nib文件时,我得到"文档不受源代码管理".而不是图形表示我看到xml.

我从2012年3月21日开始使用当前版本4.3.2(4E2002).但是这个错误昨天晚上首先出现了.重新启动和清理项目没有帮助,重新启动mac也没有帮助.当切换到另一个项目时,我没有那个问题.我不知道我改变了任何偏好.

有什么线索错了吗?

来自瑞士的问候,罗纳德霍夫曼

我发现了什么错误:"显示版本编辑器"已打开.关闭它时错误消失了. 在此输入图像描述 罗纳德

xml objective-c nib xcode4

5
推荐指数
1
解决办法
4305
查看次数

目标C:发送包含主题和正文以及切换应用的电子邮件

我想发送主题和正文的电子邮件.

这是我现在的代码,它按预期工作.它离开了我的应用并在Mail中创建了一条新消息.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:wettbewerb@neunfornkunst.ch"]];
Run Code Online (Sandbox Code Playgroud)

但是,我想创建更复杂的消息,包括主题和正文,如下所示:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:wettbewerb@neunfornkunst.ch?subject = my Subject?body = my Body"]];

一旦我添加主题,它什么都不做.
知道我做错了吗?

mailto objective-c subject document-body

4
推荐指数
1
解决办法
5327
查看次数

NSTableView数据源方法未触发

我对委托方法有疑问。将数组填充到tableView中的其中之一没有触发,我不明白为什么。结果是我的tableView具有预期的行数,但它们都是空的。我设置了断点,但它并不止于此。

有什么线索可以尝试吗?

//This is working

- (id)init  {
   self = [super init];

   cmdListMain = [NSArray arrayWithObjects: @"Cat", @"Dog", @"Fish", nil];   

   NSLog (@"init");


   return self;
}

//This is working

- (int) numberOfRowsInTableView: (NSTableView *) tv
{
    NSLog(@"numberOfRowsInTableView");
return [cmdListMain count];
}

//This one is not firing** 

- (id)cmdTableView:(NSTableView *)tv 
    objectValueForTableColumn :(NSTableColumn *)cmdTableView 
          row :(int)rowIndex
{
   NSLog(@"cmdTableView");
   NSString *v = [cmdListMain objectAtIndex:rowIndex];
   return v;
}

//This is working

-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) theApp  {
   return YES;
}
Run Code Online (Sandbox Code Playgroud)

cocoa delegates objective-c

1
推荐指数
1
解决办法
303
查看次数

使用objectAtIndex Objective-C时错误的值

我有一个包含两个元素50和60的数组:

NSArray*array = [NSArray arrayWithObjects:
                [NSNumber numberWithLong:50],
                [NSNumber numberWithLong:60], nil];
Run Code Online (Sandbox Code Playgroud)

稍后使用数组时(事实上我将此数组作为默认列表写入plist文件)我这样做:

long value = [array objectAtIndex:1];
Run Code Online (Sandbox Code Playgroud)

此值包含15559后我不明白.在调试器中[array objectAtIndex:1]清楚地显示(长)60.

在此输入图像描述

对不起,我看不出有什么不对;(

有任何想法吗?

罗纳德

indexing objective-c return-value nsarray

1
推荐指数
1
解决办法
497
查看次数

Objective-C contentsOfDirectoryAtURL需要文件名而不是完整路径

我正在使用这段代码来获取文件夹pathTo_Folder中包含的文件.我得到的是这样的:"file://localhost/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen/Tech-2.jpg","file:// localhost/Users/ronny/DEV /0200-ObjC4/ModernTimes/DrawingFun/linen/Tech-3.jpg","file://localhost/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen/Tech-4.jpg","file ://localhost/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen/Terra-1.jpg","file:// localhost/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen /Terra-2.jpg","file://localhost/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen/Terra-3.jpg","file:// localhost/Users/ronny/DEV /0200-ObjC4/ModernTimes/DrawingFun/linen/Terra-4.png","file://localhost/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen/Terra-5.png","file ://localhost/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen/Terra-6.jpg"

我想知道是否有办法只获取没有像"Tech-2.jpg"这样的包含文件夹的文件名

NSString *pathTo_Folder = @"/Users/ronny/DEV/0200-ObjC4/ModernTimes/DrawingFun/linen";

NSFileManager *fileManager = [NSFileManager defaultManager];

NSArray *theFiles =  [fileManager contentsOfDirectoryAtURL:
                      [NSURL fileURLWithPath:pathTo_Folder]
                                includingPropertiesForKeys:[NSArray arrayWithObject:NSURLNameKey]
                                                   options:NSDirectoryEnumerationSkipsHiddenFiles
                                                     error:nil];
Run Code Online (Sandbox Code Playgroud)

来自瑞士的问候,罗纳德霍夫曼

filenames file-type objective-c nsfilemanager

0
推荐指数
1
解决办法
4132
查看次数