Uialertcontroller 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