Randonee / BasisApple

Native Apple application development with haxe
39 stars 4 forks source link

UIAlertView #2

Closed wwwins closed 11 years ago

wwwins commented 11 years ago

Hi,

I tried to add a UIAlertView on my stage.

var _alert = new UIAlertView(); addSubview(_alert); _alert.title = "test"; _alert.message = "test message\n1\n2\n3"; _alert.addButtonWithTitle("cancel"); _alert.addButtonWithTitle("ok"); _alert.show();

Could i add eventListeners for my buttons?

thanks.

Randonee commented 11 years ago

The delegate for UIAlertView has not yet been implemented. I'll try to find some time today or tomorrow to add it.

Randonee commented 11 years ago

UIAlertViewDelegate support has been added. You can see it working in the example app. Here are the basics (Note you do not need to add alerts as a subview to another view):

_alertView = new UIAlertView(); _alertView.title = "Alert Test"; _alertView.message = "Test message\n1\n2\n3"; _alertView.addButtonWithTitle("cancel"); _alertView.addButtonWithTitle("ok"); _alertView.delegate.clickedButtonAtIndexHandler = clickedButtonAtIndex; _alertView.show();

private function clickedButtonAtIndex(alertView:UIAlertView, buttonIndex:Int):Void { trace("Alert Button Clicked: " + buttonIndex); }

wwwins commented 11 years ago

It works! Thank you for all your great work!