Change iphone settings based on device capabilities
Is it possible to hide certain application settings in standard Settings application based on current device capabilities? For example user can开发者_如何学编程 choose whether to show compass calibration UI or not, but I don't want to show this setting if device does not have a compass (e.g. iPhone 3g).
Well, I think that is not possible actually but may be I missed something simple here (or any other available options)...
It is possible, and it's recommended to do this. One example is to check whether the device can make phone calls:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel:"]]) {
// do stuff with a phone number
}
There are other ways to check device capabilities. Check the documentation to find them. For example, the CLLocation
docs have a +(BOOL)headingAvailable
method, which tells you if you can find out the heading.
精彩评论