Uialertview, Uiactionsheet compatible iOS8

Source: Internet
Author: User

1. PrefaceIOS8 has addedUialertcontroller to replace the use of Uialertview, Uiactionsheet. In this paper, without the use of Uialertcontroller, the simplest way to make Uialertview, Uiactionsheet compatible iOS8.
2, UialertviewUnder IOS8, ifUialertview Initialization When the title is nil, iOS8 the box below the message will be bold, and too close to the top, in order to save the version with the iOS8 before the same, only need to initialize the title to @ "" on it. 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, ifUiactionsheet Initialization When the title is @ "", iOS8 below the Actionsheet form above will be more than a row of blank bar, in order to save the version consistent with the iOS8 before, only need to initialize the title to nil on it. 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];


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.