开发者

Adding a property for a class that's only available in a later SDK

开发者 https://www.devze.com 2023-04-12 03:05 出处:网络
I want my application to run on iOS 3.0 and later and be a universal application. My problem here: What do I do, if my class needs a property of a class that\'s only introduced in a later SDK?

I want my application to run on iOS 3.0 and later and be a universal application. My problem here: What do I do, if my class needs a property of a class that's only introduced in a later SDK?

For exam开发者_运维知识库ple: My class needs a property of a UIPopovercontroller, but that's only available in 3.2 and later. Do i need to work around by defining a property of NSObject instead and then casting around to UIPopoverController all the time?


Take a look at this post on Cocoa with Love for more info about combining compile-time and run-time checks for class and method availability. The preprocessor macros that Matt Gallagher developed and posted there may meet your needs. You would have to adapt them a bit to nuance the distinction between 3.2 and 3.0, though.

All of that said, there aren't a lot of users on 3.x (as of January 2011, it was ~10%, now undoubtedly much less.)

0

精彩评论

暂无评论...
验证码 换一张
取 消