How to make a multiple line, left-aligned UIAlertView?

后端 未结 5 1291
野的像风
野的像风 2020-12-23 15:15

I am interested in making a left-aligned UIAlertView with several lines like a bulletin list that would look like the following:

  • line 1
  • line 2
5条回答
  •  长情又很酷
    2020-12-23 15:52

    to align left:

     NSArray *subviewArray = alert.subviews;
    for(int x = 0; x < [subviewArray count]; x++){
    
        if([[[subviewArray objectAtIndex:x] class] isSubclassOfClass:[UILabel class]]) {
            UILabel *label = [subviewArray objectAtIndex:x];
            label.textAlignment = UITextAlignmentLeft;
        }
    

    To show a red background behind alert view:

    alert.backgroundColor=[UIColor redColor];
    

提交回复
热议问题