Jul 26
While, as we all know, OS 3.0 has been installed or upgraded on most of the iPhones, but, there are still a lot of iPod Touch not upgraded. So, by now, we still need to develop our apps based on the OS 2.2+ then try to make it compatible with OS 3.0.
When we test our apps on OS 2.2+ and OS 3.0, we found out that some thing different in the two platforms, so if your want the same code to be built for different OS, here is the trick to do it.
You can notice that we used pre-processor directives for the conditional compilation. But there is still a problem: we have to build two binaries for the different OS. What if we want to build only one binary that can be compatible with both platforms?
This code will do it for you: Continue reading »
When we test our apps on OS 2.2+ and OS 3.0, we found out that some thing different in the two platforms, so if your want the same code to be built for different OS, here is the trick to do it.
| Objective-C | | copy code | | ? |
| 01 | - (void)viewDidLoad {
|
| 02 | |
| 03 | #ifdef __IPHONE_3_0 |
| 04 | NSInteger offset = -40; |
| 05 | #else |
| 06 | NSInteger offset = 0; |
| 07 | #endif |
| 08 | |
| 09 | /* Your code here */ |
| 10 | |
| 11 | [super viewDidLoad]; |
| 12 | } |
You can notice that we used pre-processor directives for the conditional compilation. But there is still a problem: we have to build two binaries for the different OS. What if we want to build only one binary that can be compatible with both platforms?
This code will do it for you: Continue reading »
Recent Comments