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