View Single Post
  #8 (permalink)  
Old June 25th, 2011, 01:42 AM
Mons Mons is offline
Registered User
 
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crashing Chapter 3 BasicUI

Hi Bob thanks for the quick reply and offer of support. I did swap the code which I hand set after struggling with a few typos. I switched it for the downloaded version of the basicUI m file in case I had missed something: Also Simulator 3.1.1. is what I am running. The app succeeds It is the linkage I think is the problem. Any further advice welcome. thanks for the interest.

[code]
#import "BasicUIViewController.h"

@implementation BasicUIViewController
@synthesize nameTextField;

- (IBAction)clearPinBtnClicked:(id)sender {
[secretPin setString:@""];
}

- (IBAction)pinBtnClicked:(id)sender {
[secretPin appendString:[sender titleForState:UIControlStateNormal]];
}

- (IBAction)btnClicked:(id)sender {
if ([secretPin isEqualToString: @"2345"]) {
NSString *str = [[NSString alloc] initWithFormat:@"Hello, %@", nameTextField.text ];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Hello"
message: str
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];
[alert release];
[str release];
}
}


/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
}
return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
secretPin = [[NSMutableString alloc] initWithCapacity:2];
[super viewDidLoad];
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIIn terfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/


- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}


- (void)dealloc {
[nameTextField release];
[secretPin release];
[super dealloc];
}

@end[/QUOTE]