Quote:
| Originally Posted by computerfox Anyone?...... |
I took a few hours out and did some coding for you. Im a newbie, but I aint giving up.
Most of it is done for you, still some parts left.
Everythings there, appdelegate class, viewcontrolller and nib file. etc
h t t p : / / w w w . m j c a r s p a r e s . c o . u k / p r o j y . z i p
pasted below as well. (I obviously cant paste the NIB file here!)
//
// tempConvertViewController.h
// tempConvert
//
// Created by Qessar on 13/06/2010.
// Copyright __MyCompanyName__ 2010. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface tempConvertViewController : UIViewController {
IBOutlet UITextField *temp;
IBOutlet UITextField *type;
IBOutlet UILabel *final;
}
@property (nonatomic, retain) IBOutlet UITextField *temp;
@property (nonatomic, retain) IBOutlet UITextField *type;
@property (nonatomic, retain) IBOutlet UILabel *final;
-(IBAction) convert;
@end
//
// tempConvertViewController.m
// tempConvert
//
// Created by Qessar on 13/06/2010.
// Copyright __MyCompanyName__ 2010. All rights reserved.
//
#import "tempConvertViewController.h"
@implementation tempConvertViewController
@synthesize temp;
@synthesize type;
@synthesize final;
-(IBAction)convert{
}
- (BOOL)textFieldShouldReturn

UITextField *)textField {
double tempValue = [temp.text doubleValue];
if ([type.text isEqualToString:@"C"] || [type.text isEqualToString:@"c"]) {
tempValue = (((tempValue/5)*9)+32);
}
NSString *result = [NSString stringWithFormat:@"%f", tempValue];
[temp resignFirstResponder];
final.text = result;
[textField resignFirstResponder];
return YES;
}
/*
// 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 {
[super viewDidLoad];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation

UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end