繁体   English   中英

UIWIdow 未声明 iOS 4.3 AppDelegate

[英]UIWIndow Not Declared iOS 4.3 AppDelegate

I just downloaded the newest iOS SDK (4.3) and noticed that when I start a Window Based Application, the UIWindow is not declared in the header file, it is only mentioned as a property.

#import <UIKit/UIKit.h>

@interface GleekAppDelegate : NSObject <UIApplicationDelegate> {
    IBOutlet UILabel *label;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end

我希望并记住旧的 SDK,上面的代码应该是

#import <UIKit/UIKit.h>

@interface GleekAppDelegate : NSObject <UIApplicationDelegate> {
    IBOutlet UILabel *label;

    UIWindow *window;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end

这只是 SDK 的新功能吗?

谢谢

新的 Objective-C 运行时能够在不明确声明它们的情况下合成 ivars。 Objective-C 编程语言的运行时差异

一般来说,现代和传统运行时的属性行为是相同的(请参阅 Objective-C 运行时编程指南中的“运行时版本和平台”)。 有一个关键区别:现代运行时支持实例变量合成,而传统运行时不支持。

...

对于现代运行时,如果您不提供实例变量,编译器会为您添加一个。

来自Objective-C 运行时编程指南中的运行时版本和平台

  • Mac OS X v10.5 及更高版本上的电话应用程序和 64 位程序使用现代版本的运行时。

  • 其他程序(Mac OS X 桌面上的 32 位程序)使用运行时的旧版本。

也看看这个问题:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM