- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的其中一个对象有一个属性,如下所示:
@property(nonatomic, weak) UIViewController *myParentViewController;
但是,在 ARC release notes它说:
Note: In addition, in OS X v10.7, you cannot create weak references to instances of NSFontManager, NSFontPanel, NSImage, NSTableCellView, NSViewController, NSWindow, and NSWindowController. In addition, in OS X v10.7 no classes in the AV Foundation framework support weak references.
所以我改为将属性更改为 assign
,但是现在当我键入 myParentViewController
时,自动完成显示它是 unsafe_unretained
,这让我感到害怕我一点点。
这里到底发生了什么?使用unsafe_unretained需要注意什么?我是否正确解读了文档?
最佳答案
UIViewController
不在该列表中,无论如何它仅指 OS X。您误解了文档。适用于 OS X 的内容不一定直接等同于 iOS。
关于iphone - 我不应该为 UIViewController 属性使用 (nonatomic, weak) 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12078027/
在这样的代码中,(retain, nonatomic) 和 (nonatomic, retain) 之间有什么区别: @property (retain, nonatomic) YellowViewC
@property(nonatomic)ivar 和 @property(nonatomic,assign)ivar 相同还是不同? 最佳答案 如 docs 中所述: assign - Specifi
@interface PaneBean : NSObject @property(nonatomic,copy) NSString *name; @property(nonatomic,copy) N
这段代码中的“非原子”是什么意思? @property(nonatomic, retain) UITextField *theUsersName; 原子和非原子有什么区别? 谢谢 最佳答案 看看App
我想知道:iPhone 开发中的所有属性都应该是 nonatomic 吗?如果是,为什么? 最佳答案 来自 The Objective-C Programming Language,强制性指南: 原子
我使用 Xcode 中的分析工具(分配)发现的是,当您清零一个属性时,它不会被释放,直到父类被清空。现在假设你想确保你不会在内存中保留一个昂贵的模态视图 Controller (假设它不会经常使用),
假设我有属性 @property (readonly) NSString* p1; @property (readonly, copy) NSString* p2; @property (readon
带有@property nonatomic 和 retain 的变量是否应该显式释放。 @interface MyScreenViewController : UIViewController {
具体详细介绍请看下文文字说明吧,本文介绍的非常详细。 1 . 可读性: readonly、readwrite @property(readwrite,....) valueType value;
我的其中一个对象有一个属性,如下所示: @property(nonatomic, weak) UIViewController *myParentViewController; 但是,在 ARC re
我在我的 .xib 文件中创建了一个分段控件和一个 TextView ,并在 .h 文件中将其声明为 @interface controlsViewController : UIViewControl
编辑:这个问题也适用于普通声明的属性(不仅适用于类属性)! 原帖: 假设我有一个公共(public)类方法 sharedInstance,它目前是作为一个 getter 方法实现的: @interfa
从自定义并发队列的 dispatch_barrier 中访问非原子变量是否安全? 以下代码片段是使用分派(dispatch)屏障的方法的简化版本: - (void)cacheData:(NSData
谁能解释一下这行是什么意思?我曾经看到 (nonatomic,retain) 这是我第一次看到“assign”关键字: @property (nonatomic, assign) id delega
我想知道如何在 C++ 中正确创建属性。在 Objective C 中,我使用“@property”(通常与 (nonatomic, retain) 属性一起使用)。 C++ 中正确的方法是什么? 谢
我正在深入研究 iOS 开发,我发现对于我的每个 UI 控件,我总是像这样盲目地声明它们的 @property,因为这就是我开始学习时阅读的一些教程中的做法... @property (retain,
在 Xcode 8 中遇到非常奇怪的错误: 我在 .h 文件中得到了属性: @property (nonatomic) BOOL isInAirmode; 以及 .m 中的访问器: - (void)s
如果我在类中声明了一个属性: @interface MyClass : NSObject @property (atomic) NSString *myString; @end 我实现了自定义的 ge
我正在开发一个针对 iOS 5.1+ 的 iOS 应用程序。我在 Mac OS X 10.8 上使用 XCode 4.5,并且我拥有一台装有 iOS 5.1.1 的 iPhone 4。该应用程序需要
尝试实现 NSItemProviderReading 协议(protocol)。在 Objective-C 中,你如何满足: @property(class, readonly, copy, nona
我是一名优秀的程序员,十分优秀!