"We all love Paul Hegarty." Stanford IOS8 public class personal note alert&actionsheet

Source: Internet
Author: User

Alert and Actionsheet are the two tools that pop up messages in iOS.
First of all, they are presented in a modal way.

Alert is used to initiate a query to the user, either with one (such as cancel) or two options (such as OK and cancel) or with a text box (such as asking the user to enter a password)
The Action sheet slides out from the bottom of the screen, providing options for branching, and the number of options can be greater than two.
Contrast

Both action Sheet and alert can be created using uialertcontroller, such as creating an action Sheet, making its title and introduction in the constructor, and note the style selection Actionsheet:

As for the columns in action sheet you need to add them separately, using the Uialertaction constructor:

In the iOS API, handler is a closed packet.
Detailed information such as:

Note that clouseup of sun is red, this is not the color we set it, but its type is destructive, if you want to let a column play the role of closing, choose this style, and finally cancle is a type, You can see that it is clearly independent of the above columns. Click Cancel to return to the previous page. So how to get our action sheet on the screen, using method Presentviewcontroller, the whole method is to make a controller the current controller:

Completion is a closure that is called when the Actionsheet renders to the page.
The ipad is presented in a popover way.

The use of alert is similar

We want to add a text box to the alert by doing the following:

Once this method is called, the text box set in the closure will work, where a placeholder is set for the text box.
You can use the following procedure to set a login's judgment:

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"We all love Paul Hegarty." Stanford IOS8 public class personal note alert&actionsheet

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.