Updating UIAlertView Message dynamically and newline character issue

前端 未结 5 1648
萌比男神i
萌比男神i 2021-01-22 00:21

I need to display multiple lines of text in the message of my UIAlertView. I have tried adding a \'\\n\', but it has no effect. It still displays: \"This is an examp....\".

5条回答
  •  忘掉有多难
    2021-01-22 01:08

    1. Create your own AlertView Category.

    AlertWithBlock.h file

    #import 
    
    @interface UIAlertView (AlertWithBlock)
    
    - (void (^)(UIAlertView *alertView, NSInteger buttonIndex))delegateBlock;
    
    - (void)setDelegateBlock:(void (^)(UIAlertView *alertView, NSInteger buttonIndex))delegateBlock;
    
    
    + (void)alertViewWithTitle:(NSString *)title buttonTitle:(NSString *)buttonTitle message:(NSString *)message;
    
    + (UIAlertView *)alertWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString   *)cancelButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles delegate:(void (^)(UIAlertView *alertView, NSInteger buttonIndex))delegate;
    
    @end
    

提交回复
热议问题