Instance Method

initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:

Convenience method for initializing an alert view.

Declaration

- (instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...;

Parameters

title

The string that appears in the receiver’s title bar.

message

Descriptive text that provides more details than the title.

delegate

The receiver’s delegate or nil if it doesn’t have a delegate.

cancelButtonTitle

The title of the cancel button or nil if there is no cancel button.

Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title.

otherButtonTitles,

The title of another button.

Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons.

Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see Temporary Views.

...

Titles of additional buttons to add to the receiver, terminated with nil.

Return Value

Newly initialized alert view.

See Also

Creating Alert Views