I'm new to Cocoa Touch and I'm just messing around trying to get a feel for the language and framework. So I'm just trying to create a simple app that takes text from a UITextField
and just shows it in a UIAlertView
here is the action method:
- (IBAction)showNotifAction:(id)sender {
putVal = _TextToDisplay.text;
_alertOne.title = @"Message";
_alertOne.message = putVal;
[_alertOne show];
}
For some reason it breaks on line 3 with a SIGART. Is there something I'm doing wrong? Oh, BTW, here is my AppDelegate
implementation:
@interface LearnAppDelegate : NSObject <UIApplicationDelegate> {
UITextField *_TextToDisplay;
UIButton *_ShowNotif;
UIAlertView *_alertOne;
NSString *putVal;
}
You need to define your UIAlertVIew. Pointer that you are trying to use points to nothing or to garbaged memory.
Try something like the following code:
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:"My title"
message:putVal
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[alert show];
精彩评论