How to hide title/message frame in a UIAlertController? How to hide title/message frame in a UIAlertController? ios ios

How to hide title/message frame in a UIAlertController?


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?


Update Swift 4:

let alert = UIAlertController(title: nil, message: nil, preferredStyle: UIAlertControllerStyle.actionSheet)

Just need to pass nil to title and message params.


If you want to change in run time depending on a certain case just write:

actionController.title = nil
actionController.message = nil