什么是“强”关键字do [英] What does the "strong" keyword do

查看:184
本文介绍了什么是“强”关键字do的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了Xcode 4.2开发者预览版本,我创建了一个可可应用程序。但是我在委托类中发现了一个非常奇怪的语法:

I downloaded the Xcode 4.2 developer preview version and I created a cocoa application. But I found a very weird syntax in the delegate class:

@property (strong) IBOutlet NSWindow *window;

这是什么意思?编译器甚至不能编译它。

What does this mean? And the compiler can't even compile it.

提前感谢!

推荐答案

它表明这个属性是一个强关系 - 一个所有权。 ARC 版本的保留关键字在相同的上下文。

It indicates that this property is a strong relationship—an ownership. It's ARC's version of the retain keyword in the same context.


编译器甚至无法编译它。

And the compiler can't even compile it.

这是有效的ARC代码,所以如果你的工具支持ARC,他们当然应该能够编译它。

It's valid ARC code, so if your tools support ARC, they certainly should be able to compile it.

使用Xcode 4.2或更高版本,并且您将项目的编译器选择设置为Clang(Apple LLVM Compiler)。

Make sure that you're using Xcode 4.2 or later, and that you have the project's compiler choice set to Clang ("Apple LLVM Compiler").

这篇关于什么是“强”关键字do的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆