Custom TextField in UIAlertController [duplicate]

瘦欲@ 提交于 2019-12-11 14:19:05

问题


I could add a textfield in UIAlertController using

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
    [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {

    }];

Is there any possibility to add a custom textfield inside an alert controller?


回答1:


I do not think that it's possible to use a UITextField subclass in an UIAlertController. You can only edit the textfield's properties in the configuration handler.




回答2:


No, you can't. You have to implement custom Alert View for this purpose. You can try libraries - ALERT ACTION SHEET LIBRARIES.

Or if you need text field with UIAlertView its self with a 'clean' look - UITextField in UIAlertController (border, backgroundColor)



来源:https://stackoverflow.com/questions/45758565/custom-textfield-in-uialertcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!