Link Address: http://blog.csdn.net/nextstudio/article/details/39959895?utm_source=tuicool1, Preface IOS8 added Uialertcontroller 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, UIAlertViewiOS8, if the Uialertview initialization when the title is nil, iOS8 the following box in the message will be bold, and too close to the top, in order to save the same version as before IOS8, You only need to set the title to @ "at initialization time. The code is as follows:[OBJC]View Plaincopy
- The title is @ "" compatible with IOS8
- Uialertview *delalert = [[[Uialertview alloc] initwithtitle:@ "" message:@ "Delete a contact? " delegate:self cancelbuttontitle:@" Cancel " otherbuttontitles:@" Confirm ", Nil Nil] Autorelease];
- [Delalert show];
3, UIActionSheetiOS8, if Uiactionsheet 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 of the same as before IOS8, You only need to set the title to nil at initialization time. The code is as follows:[OBJC]View Plaincopy
- 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