Showing a native iPhone UIAlertView from C++ code


#1

Hi, I’m trying to show a native alert on iOS from my c*+ code. In order to do so, I tried to imitate the cocosdenshion implementation. I added a cpp bridge class that calls an objective-C class that will actually show the alert.
The alert works, but the delegate event after clicking at the alert options doesn’t seem to work. If I can get this to work I’ll write a tutorial in my blog… many people has the same problem. Can you help me please?

h2. CLASS IMPLEMENTATION:
`#import “iOSHelper_objc.h”

implementation iOSHelper\_objc *(void) ShowAlert{ UIAlertView **alertDialog; alertDialog = initWithTitle:"This is the title"
message:“This is the message” delegate:self cancelButtonTitle:"OK"
otherButtonTitles:“NO!”,“MAYBE…”, nil];

[alertDialog show];
[alertDialog release];

}

-(void)alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex
{
UIAlertView *alertDialog;

alertDialog = [[UIAlertView alloc]
               initWithTitle:`“Result”

message:"I know what you did" delegate:self cancelButtonTitle:“Ok”
otherButtonTitles: nil];
;
;
}

end
h2.**CLASS DEFINITION (HEADER)*

`interface iOSHelper_objc : UIViewController

+(void) ShowAlert;

`end