简体   繁体   中英

AlertView vs. AlertController in iOS7 and iOS8

I've been reading that AlertController should be used for iOS 8 and up, while in iOS7 versions the AlertView is used.

Well I'm currently working on an app that I'd like to be compatible for iOS7 and up. Do I have to either choose AlertView to only have iOS7 users use it and not 8, or choose AlertController and neglect everyone on iOS7 to not be able to use it?

I'd like to get both crowds, but it seems I can only use one and isolate a group of users.....is there a way to utilize both?

You can use both. One for iOS 7 and one for iOS 8. Just do something like this:

if ([UIAlertController class]) }
  // iOS 8 - show alert controller
} else {
  // iOS 7 - show alert view
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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