在需要10.6并且是64位的mac os项目(意思不是iPhone)上工作,允许我使用属性在头文件中生成访问器方法和实例变量.但是,在调试期间,我没有看到如何在填充对象的属性值后查看它们.是否有一些需要打开的构建设置?
如果我声明一个对象的实例变量(在标题中的{}之间),那么我可以在调试期间在调试窗口本身中看到这些值(当它们被使用时),或者通过使用光标悬停在突出显示的线条技巧上在休息期间在编辑器中,或者像在'p*object'中那样在gdb中执行cli.
旧方式:
@class Suit;
@interface Card : NSObject
{
NSNumber *playOrder;
Suit *suit;
NSNumber *displayNumber;
NSNumber *orderIndex;
}
@property(nonatomic, retain) Suit *suit;
@property(nonatomic, retain) NSNumber *displayNumber;
@property(nonatomic, retain) NSNumber *orderIndex;
Run Code Online (Sandbox Code Playgroud)
新方法:
@class Suit;
@interface Card : NSObject
@property(nonatomic, retain) Suit *suit;
@property(nonatomic, retain) NSNumber *displayNumber;
@property(nonatomic, retain) NSNumber *orderIndex;
@property(nonatomic, retain) NSNumber *playOrder;
Run Code Online (Sandbox Code Playgroud)
在这个新的10.6需要64位的想法(这对我来说似乎更简单)这些调试方法都没有显示对象的值.我认为我必须关掉一些东西,因为这个新想法看起来并不好.
旧方式的gdb结果:
(gdb) po newCard
New Card : 0 of Suit : Hearts (NSCalibratedRGBColorSpace 1 0 0 1). with orderIndex of: 1
(gdb) p *newCard …Run Code Online (Sandbox Code Playgroud) 文档说明:
...此方法始终返回一个对象.假定objectID表示的持久性存储中的数据存在 - 如果不存在,则在访问任何属性时(即,触发错误时),返回的对象将引发异常.此行为的好处是它允许您创建和使用故障,然后在以后或在单独的上下文中创建基础行.
在Apple的'Core Recipes'示例应用程序中,该方法的结果用于填充NSFetchRequest,然后使用请求的结果,并对此结果进行注释:
// first get the object into the context
Recipe *recipeFault = (Recipe *)[context objectWithID:objectID];
// this only creates a fault, which may NOT resolve to an object (for example, if the ID is for
// an objec that has been deleted already): create a fetch request to get the object for real
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity: [NSEntityDescription entityForName:@"Recipe" inManagedObjectContext:context]];
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"(self == %@)", recipeFault];
[request …Run Code Online (Sandbox Code Playgroud) 窗口的contentView有NSTextFields.(苹果系统)
我正在使用界面构建器来设置窗口及其功能,所以awakeFromNib中没有任何内容,除了这个:
[[self.window contentView] setWantsLayer:YES];
CALayer *layer = [[self.window contentView] layer];
CGColorRef lightGray = CGColorCreateGenericGray(0.93, 1.0);
[layer setBackgroundColor:lightGray];
CGColorRelease(lightGray);
Run Code Online (Sandbox Code Playgroud)
但是,textField的焦点环在textField的边界之外是不可见的.
带图层:

没有图层:

我认为这个显示问题比这更大,但我找不到这个问题的例子,(和解决方案).
任何人?
我需要避免此枚举中的隐藏文件,但仍会添加.DS_Store文件.
我把NSLog放进去检查,我在那里输出.
可能有一些明显的东西,但我看不到它.
NSDirectoryEnumerator *dirEnumerator;
NSFileManager *fileManager = [[NSFileManager alloc] init];
dirEnumerator = [fileManager enumeratorAtURL:item
includingPropertiesForKeys:[NSArray array]
options:NSDirectoryEnumerationSkipsPackageDescendants || NSDirectoryEnumerationSkipsHiddenFiles
errorHandler:nil];
for (NSURL *urlItem in dirEnumerator) {
// is item hidden ?
NSNumber *isHidden = nil;
if ([urlItem getResourceValue:&isHidden forKey:NSURLIsHiddenKey error:nil]) {
if ([isHidden isEqual:[NSNumber numberWithInt:1]]) {
NSLog(@"isHidden is 1");
continue;
}
}
Run Code Online (Sandbox Code Playgroud)