How to hide title/message frame in a UIAlertController?

vlin picture vlin · Apr 21, 2015 · Viewed 17.8k times · Source

When using a UIAlertController, if I want to present a UIActionSheet with an empty title and an empty message, the frame for the expected placement of the title and/or message remains.

How do I change this so that I only present an ActionSheet that reads:

Settings
Sign out
Cancel ?

Thanks!

UIAlertController example

Answer

aahrens picture aahrens · Apr 21, 2015

When I create a UIAlertController with this code I don't have the title spacing.

[UIAlertController alertControllerWithTitle:nil
                                    message:nil
                             preferredStyle:UIAlertControllerStyleActionSheet];

Are you passing in nil for the title and message or empty strings?