---
title: "TextAlign not working in UIAlertView?"  
description: "TextAlign not working in UIAlertView?"  
author: "Anonymous User"  
published: 2015-08-07  
updated: 2015-08-07  
canonical: https://www.mindstick.com/forum/33401/textalign-not-working-in-uialertview  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# TextAlign not working in UIAlertView?

I want to Aligned my [message](https://www.mindstick.com/forum/12802/show-confirmation-message-yes-or-no-in-asp-dot-net) text in UIAlertView and here is my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) but when i running this code the text appear as before and nothing change after [for loop](https://www.mindstick.com/forum/12568/android-for-loop-not-working-in-main-thread). i also want to [increase](https://www.mindstick.com/articles/12959/are-you-struggling-to-increase-the-profit-of-your-liquor-store) my text? I am using this code [Align text](https://www.mindstick.com/forum/159390/how-do-i-vertically-align-text-in-a-div-please-provide-sample) in a UIAlertView that has a scrollbar [right now](https://answers.mindstick.com/qa/36863/what-would-happen-if-gravity-became-5-percent-stronger-right-now).

```
UIAlertView *alret = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat: @"%@",                                      [title objectAtIndex:indexPath.row]]  message:                                      [NSString stringWithFormat:@"%@",                                      [description objectAtIndex:indexPath.row]] delegate:nil                                      cancelButtonTitle: @"OK"  otherButtonTitles:nil];
for(id subview in alret.subviews) {
       if([subview isKindOfClass:[UITextView class]]) {
           [(UITextView *)subview  setTextAlignment:NSTextAlignmentJustified];
       }}
[alret show];
```

## Replies

### Reply by Tarun Kumar

Try this

```
for (UIView *view in alert.subviews) {
       if([[view class] isSubclassOfClass:[UILabel class]]) {
            ((UILabel*)view).textAlignment = NSTextAlignmentLeft;
    }}
```

Hope it helps.


---

Original Source: https://www.mindstick.com/forum/33401/textalign-not-working-in-uialertview

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
