Customize UIAlertController in iOS 8 to include standard elements like UITableView

后端 未结 4 1050
傲寒
傲寒 2020-12-23 15:33

I am used to customize UIAlertViews through the [alert setValue:someView forKey:@\"accessoryView\"] method. This creates customizable content for U

4条回答
  •  情书的邮戳
    2020-12-23 15:50

    I suggest not your wasting time trying to cram additional UI into a place where isn't supposed to be. Based on the last few years of improvements, Apple will probably add a custom view in the next iOS. Until then, have a look at a framework designed to handle this exact situation without subverting any best practices: SDCAlertView

    It supports alerts that imitate the native alerts on iOS 7,8,9, including handling all of the nasty edge cases around sizing, button types, rotation, etc. It does support arbitrary custom views within the alert.

    I use this library in Yahoo YMPromptKit for custom push notification prompts that look exactly like iOS native. Here's another example:

提交回复
热议问题