How to move the buttons in a UIAlertView to make room for an inserted UITextField?

后端 未结 8 750
挽巷
挽巷 2020-12-24 00:07

[EDIT] Hmm. Perhaps this question should be titled \"what is the default user-input dialog view called in CocoaTouch?\" I realize that I can create an entire view that is

8条回答
  •  春和景丽
    2020-12-24 00:35

    Explains how to set the number of columns, have not tested it.

    http://iloveco.de/uikit-alert-types/

    However there is a private method, setNumberOfRows:(int)n that will allow you to set a maximum number of rows to display the buttons in. To use this method we need to add our own additions to the UIAlertView class. We do this by adding an @interface for UIAlertView in our .m file.

    // extend the UIAlertView class to remove the warning caused
    // by calling setNumberOfRows.
    @interface UIAlertView (extended)
    - (void) setNumberOfRows:(int)num;
    @end
    

    This will allow us to call the method without the compiler throwing us a warning.

    [myAlert setNumberOfRows:2];
    

提交回复
热议问题