When I run the iOSKit (in debug mode on an iPad) => UIAlertView and touch on “Press Me!”, the app crashes. Also when I build this app for iOS and run it on an real iPad. On an iPhone it works perfect.
Does anyone have a solution for this problem?
When I run the iOSKit (in debug mode on an iPad) => UIAlertView and touch on “Press Me!”, the app crashes. Also when I build this app for iOS and run it on an real iPad. On an iPhone it works perfect.
Does anyone have a solution for this problem?
Off the top of my head, I think there’s a style parameter? It has to be 1 on an iPad because the iPad doesn’t support the alert style that scrolls up from the bottom of the screen, only the style that has the alert in the centre of the screen. So I have some code that over-rides this for iPad, e.g.:
if iPad then style = 1
Hi Jason,
thank you for this hint. This is the solution:
using UIKit
dim alert as UIAlertAction = UIAlertAction.ActionWithTitleStyleHandler(“TitleMsg”, UIAlertAction.UIAlertActionStyle.Destructive, AddressOf CompHandler)
if isIPad then
alertController = UIAlertController.AlertControllerWithTitleMessagePreferredStyle(“msg1”, msg2, UIAlertController.UIAlertControllerStyle.Alert)
else
alertController = UIAlertController.AlertControllerWithTitleMessagePreferredStyle(lmsg3, msg4, UIAlertController.UIAlertControllerStyle.ActionSheet)
end if
alert = UIAlertAction.ActionWithTitleStyleHandler(“Cancel”, UIAlertAction.UIAlertActionStyle.Default, AddressOf CompHandler)
alertController.AddAction alert
alert = UIAlertAction.ActionWithTitleStyleHandler(l"Delete", UIAlertAction.UIAlertActionStyle.Destructive, AddressOf CompHandler)
alertController.AddAction alert
alert = UIAlertAction.ActionWithTitleStyleHandler(l"Another Button", UIAlertAction.UIAlertActionStyle.Cancel, AddressOf CompHandler)
alertController.AddAction alert
alertController.PresentInView(self)