Advertisement
Guest User

Untitled

a guest
Feb 10th, 2011
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #if defined (TARGET_OS_IPHONE)
  2. #import <UIKit/UIAlert.h>
  3.  
  4. @interface GLB_MessageBoxer : NSObject <UIAlertViewDelegate> {
  5. NSString *resString;
  6. UITextField *txtValue;
  7. }
  8.  
  9. - (void)initBoxWithTitle:(NSString*)strTitle andMessage:(NSString*)strMessage andButtons:(NSMutableArray*)btnKnopps;
  10. - (const char*)getValue();
  11. @end
  12.  
  13. @implementation GLB_MessageBoxer
  14.  
  15. - (void)initBoxWithTitle:(NSString*)strTitle andMessage:(NSString*)strMessage andButtons:(NSMutableArray*)btnKnopps {
  16.  
  17. UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strTitle
  18. message:strMessage
  19. delegate:self
  20. cancelButtonTitle:[btnKnopps valueAtIndex:0]
  21. otherButtonTitles: nil];
  22.  
  23. UITextField *theTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
  24. [theTextField setBackgroundColor:[UIColor whiteColor]];
  25. [alert addSubview:theTextField];
  26. CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 130.0);
  27. [alert setTransform:translate];
  28. [alert show];
  29. [alert release];
  30. }
  31.  
  32. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  33. {
  34. resString = [txtValue stringValue];
  35. }
  36.  
  37. - (const char*)getValue() {
  38. return [reString UTF8String];
  39. }
  40.  
  41. @end
  42.  
  43.  
  44. GLB_MessageBoxer *myBoxer;
  45.  
  46. extern "C" void iPhoneMessageBox(const char* pText, const char* pInfo)
  47. {
  48. myBoxer = [[GLB_MessageBoxer alloc]init];
  49. [myBoxer initBoxWithTitle:[NSString stringWithUTF8String:pText] andMessage:[NSString stringWithUTF8String:pInfo andButtons:[NSArray arrayWithObjects:@"ok",nil]]];
  50. }
  51.  
  52. extern "C" const char* iPhoneGetInputValue() {
  53. return [myBoxer getValue];
  54. }
  55. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement