1

I am using UIAlertView as below

UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Review" message:[dictionary valueForKey:@"Review"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];

Image using default UIAlertView

UIAlertView using Accessory View

    NSMutableString *message = [NSMutableString string];
    NSString *title = [dictionary valueForKey:@"REVIEW"];
    [message appendString:title];
    [message appendString:@"\n"];

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Review" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

    [alert setValue:[self getLabelWithMessage:message  withTitle:title] forKey:@"accessoryView"];
    [alert show];

UIAlertView - using AccessoryView

2nd solution working fine for me as per below solution

Simple UIAlertView with NSAttributedString(s)

But this solution will it approved by Apple?

[alert setValue:[self getLabelWithMessage:message  withTitle:title] forKey:@"accessoryView"];

I need to set Left Alignment to Message in UIAlertView.

Any suggestions for any other alternative solution.

Thanks in Advance.

Vidhyanand
  • 5,369
  • 4
  • 26
  • 59
  • solutions that uses alertView subviews are not working...! – Vidhyanand Oct 10 '17 at 10:20
  • I though this post was about a few years ago, but it seems it is quite recent so I feel to spoil this, but `UIAlertView` is deprecated since iOS9 – and [`UIAlertController`](https://developer.apple.com/documentation/uikit/uialertcontroller) is a new kid on the block. – holex Oct 10 '17 at 10:33

1 Answers1

0

First of all, I would like to highlight that UIAlertView is deprecated since iOS 9. Try and use the UIAlertController. But that will not serve your purpose of customising the alignment.

Secondly, UIAlertView, UIAlertController, UIActionSheet are considered to be system controls, which means customizing their appearances is not advised. I don't think doing so will affect your review process. But you never know, the Apple reviewers sometimes accept some apps and reject some having the same restricted things. This is why we should stick to the guidelines.

Mayur Deshmukh
  • 1,169
  • 10
  • 25