Last active
December 10, 2015 08:58
-
-
Save okaram/4410700 to your computer and use it in GitHub Desktop.
iOS first App - Temperature conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(IBAction) convertToCelsius:(id)sender | |
{ | |
int f=[self.fahrenheit.text intValue]; | |
int c=[self faren2celsius:f]; | |
self.celsius.text=[NSString stringWithFormat:@"%d",c]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(float)faren2celsius:(int) faren | |
{ | |
return (faren-32)/1.8; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface TempViewController : UIViewController | |
@property(weak,nonatomic) IBOutlet UITextField* fahrenheit; | |
@property(weak,nonatomic) IBOutlet UILabel* celsius; | |
-(IBAction) convertToCelsius:(id)sender; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment