Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined (TARGET_OS_IPHONE)
- #import <UIKit/UIAlert.h>
- @interface GLB_MessageBoxer : NSObject <UIAlertViewDelegate> {
- NSString *resString;
- UITextField *txtValue;
- }
- - (void)initBoxWithTitle:(NSString*)strTitle andMessage:(NSString*)strMessage andButtons:(NSMutableArray*)btnKnopps;
- - (const char*)getValue();
- @end
- @implementation GLB_MessageBoxer
- - (void)initBoxWithTitle:(NSString*)strTitle andMessage:(NSString*)strMessage andButtons:(NSMutableArray*)btnKnopps {
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strTitle
- message:strMessage
- delegate:self
- cancelButtonTitle:[btnKnopps valueAtIndex:0]
- otherButtonTitles: nil];
- UITextField *theTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
- [theTextField setBackgroundColor:[UIColor whiteColor]];
- [alert addSubview:theTextField];
- CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 130.0);
- [alert setTransform:translate];
- [alert show];
- [alert release];
- }
- - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- {
- resString = [txtValue stringValue];
- }
- - (const char*)getValue() {
- return [reString UTF8String];
- }
- @end
- GLB_MessageBoxer *myBoxer;
- extern "C" void iPhoneMessageBox(const char* pText, const char* pInfo)
- {
- myBoxer = [[GLB_MessageBoxer alloc]init];
- [myBoxer initBoxWithTitle:[NSString stringWithUTF8String:pText] andMessage:[NSString stringWithUTF8String:pInfo andButtons:[NSArray arrayWithObjects:@"ok",nil]]];
- }
- extern "C" const char* iPhoneGetInputValue() {
- return [myBoxer getValue];
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement