I hope someone can help with this!
I have been following tutorials on how to build iOS applications and have downloaded an example project.
This project seems to run and compile for everyone else except me!
When I run the app in the simulator, none of the buttons or text fields work. There is no response and no errors.
Has anyone else had this issue?
FirstViewController.h
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController {
UITextField *tempTextBox;
UILabel *calcResult;
}
@property (nonatomic, retain) IBOutlet UILabel *calcResult;
@property (nonatomic, retain) IBOutlet UITextField *tempTextBox;
- (IBAction) degreeConvert:(id)sender;
- (IBAction) backgroundTouchedHideKeyboard:(id)sender;
@end
FirstViewController.m
#import "FirstViewController.h"
@implementation FirstViewController
@synthesize tempTextBox, calcResult;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)degreeConvert:(id)sender
{
NSLog(@"IBAction triggered succesfully");
double fahren = [tempTextBox.text doubleValue];
double celcius = (fahren - 32) / 1.8;
[tempTextBox resignFirstResponder];
//create new string with celcius formatting
NSString *convertResult = [[NSString alloc] initWithFormat:@"Celcius:%f", celcius];
//output converted result to calcResult Label
calcResult.text = convertResult;
}
-(void) backgroundTouchedHideKeyboard:(id)sender
{
[tempTextBox resignFirstResponder];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.tempTextBox = nil;
self.calcResult=nil;
}
@end