How to vertically align text for a UITextView?

astahirastahir USMember ✭✭

Hi all,

I have a UITextView which will usually be of bigger size as compared to the text it will contain. So the idea is to show the text horizontally AND vertically center aligned. As you all know horizontal alignment is really easy but I'm stuck with the vertical one; please let me know how to achieve that?

Alternatively, if that's too lengthy / cumbersome, let me know how to wrap text (so that no text is cut for my UITextView) and I will apply constraints to place the UITextView where I want to show the text.

Thanks.

Answers

  • shamnadmhshamnadmh INMember
    edited October 2015

    this might help you
    textViewName.TextAlignment = UITextAlignment.Center;

  • astahirastahir USMember ✭✭

    @shamnadmh, I have already done that for horizontal alignment, now I am looking for a way to align text vertically.

  • shamnadmhshamnadmh INMember

    what is your problem can you plz explain can you plz draw a image about your requirement

  • shamnadmhshamnadmh INMember

    i hope https://forums.xamarin.com/discussion/20388/label-position-and-text-alignment will help you becoz you also need to align your layout too not only the label you can also try like this

  • astahirastahir USMember ✭✭

    The link that you shared is for Xamarin.Forms and it also talks about centering text horizontally (which I have already achieved). Basically my UITextView is big, suppose it covers the whole screen. Now I want to show my text in the middle of the screen width (this is horizontal alignment and can easily be done) and also in the middle of the screen height (this is giving me trouble).

    Anyway, I no longer seek the solution as my client has changed the design and now I don't want that functionality.

Sign In or Register to comment.