Uialertview, Uiactionsheet compatible iOS8

Source: Internet
Author: User

1. PrefaceIOS8 addUialertcontroller replaces the use of Uialertview and Uiactionsheet.

In this paper, without the use of Uialertcontroller, the simplest way to make Uialertview, Uiactionsheet compatible iOS8.
2, UialertviewiOS8, assuming Uialertview initialization when the title is nil words. IOS8 the message in the following bullet box becomes bold. And too close to the top. In order to preserve the same version number as before IOS8, it is only necessary to place the title @ "" at initialization time. The code is as follows:

Title @ "" Compatible iOS8    uialertview *delalert = [[[Uialertview alloc] initwithtitle:@ "message:@" delete contacts? "Delegate:self cancelbuttontitle:@" Cancel "otherbuttontitles:@" confirmation ", Nil] autorelease];    [Delalert show];

3, UiactionsheetUnder IOS8, supposeUiactionsheet Initialization When the title is @ "", iOS8 the following actionsheet the form above will be more than a row of blank bar. In order to save the same version number as before iOS8. You just need to set the title to nil at initialization time. The code is as follows:
Uiactionsheet *actionsheet = [[[Uiactionsheet alloc] initwithtitle:nil                                                              delegate:self                                                     cancelbuttontitle: Nslocalizedstring (@ "Cancel", nil)                                                destructivebuttontitle:[nsstring stringwithformat:nslocalizedstring (@ "Call ", nil), Self.phonenumber]                                                     otherbuttontitles:nslocalizedstring (@" Add to contact ", nil), nil]                                  autorelease];    Actionsheet.tag = 1;    [Actionsheet ShowInView:self.view];


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Uialertview, Uiactionsheet compatible iOS8

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.