Here is a simple Unit converter App.
Description : If you Enter any integer in the textfields,it gives the conversions as per the mentioned format.
So the actual task goes here..
It needs few enhancements that can be implemented with some additional piece of logic.
Find out where the App is lacking the behaviour of unit Conversion interms of UI(user interface) and implement them.
For your reference the actual code:
unitConverter.h
unitConverter.m
ScreenShots for your understanding.
Note : Please do Mapping in the xib file inorder to make the app work in the device or simulator.As there is a delegate for the textField (hide keypad) make sure that you do reverse mapping for the delegate to the file's owner.
Description : If you Enter any integer in the textfields,it gives the conversions as per the mentioned format.
So the actual task goes here..
It needs few enhancements that can be implemented with some additional piece of logic.
Find out where the App is lacking the behaviour of unit Conversion interms of UI(user interface) and implement them.
For your reference the actual code:
unitConverter.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController<UITextFieldDelegate>
{
IBOutlet UITextField *txt1;
IBOutlet UITextField *txt2;
IBOutlet UITextField *txt3;
IBOutlet UITextField *txt4;
IBOutlet UIButton *btn;
}
-(IBAction)showValues:(id)sender;
@end
@interface ViewController : UIViewController<UITextFieldDelegate>
{
IBOutlet UITextField *txt1;
IBOutlet UITextField *txt2;
IBOutlet UITextField *txt3;
IBOutlet UITextField *txt4;
IBOutlet UIButton *btn;
}
-(IBAction)showValues:(id)sender;
@end
unitConverter.m
-(IBAction)showValues:(id)sender
{
if ([txt2 isFirstResponder])
{
NSString *inputString = [[NSString alloc]initWithFormat:txt2.text];
int value = [inputString intValue];
NSLog(@"%x",value);
txt3.text=[NSString stringWithFormat:@"%x", value];
txt2.text=[NSString stringWithFormat:@"%o", value];
txt4.text=[NSString stringWithFormat:@"%d", value];
}
else if ([txt3 isFirstResponder])
{
NSString *inputString = [[NSString alloc]initWithFormat:txt3.text];
int value = [inputString intValue];
NSLog(@"%x",value);
txt3.text=[NSString stringWithFormat:@"%x", value];
txt2.text=[NSString stringWithFormat:@"%o", value];
txt4.text=[NSString stringWithFormat:@"%d", value]; }
else if ([txt4 isFirstResponder])
{
NSString *inputString = [[NSString alloc]initWithFormat:txt4.text];
int value = [inputString intValue];
NSLog(@"%x",value);
txt3.text=[NSString stringWithFormat:@"%x", value];
txt2.text=[NSString stringWithFormat:@"%o", value];
txt4.text=[NSString stringWithFormat:@"%d", value];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
{
if ([txt2 isFirstResponder])
{
NSString *inputString = [[NSString alloc]initWithFormat:txt2.text];
int value = [inputString intValue];
NSLog(@"%x",value);
txt3.text=[NSString stringWithFormat:@"%x", value];
txt2.text=[NSString stringWithFormat:@"%o", value];
txt4.text=[NSString stringWithFormat:@"%d", value];
}
else if ([txt3 isFirstResponder])
{
NSString *inputString = [[NSString alloc]initWithFormat:txt3.text];
int value = [inputString intValue];
NSLog(@"%x",value);
txt3.text=[NSString stringWithFormat:@"%x", value];
txt2.text=[NSString stringWithFormat:@"%o", value];
txt4.text=[NSString stringWithFormat:@"%d", value]; }
else if ([txt4 isFirstResponder])
{
NSString *inputString = [[NSString alloc]initWithFormat:txt4.text];
int value = [inputString intValue];
NSLog(@"%x",value);
txt3.text=[NSString stringWithFormat:@"%x", value];
txt2.text=[NSString stringWithFormat:@"%o", value];
txt4.text=[NSString stringWithFormat:@"%d", value];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
ScreenShots for your understanding.
Note : Please do Mapping in the xib file inorder to make the app work in the device or simulator.As there is a delegate for the textField (hide keypad) make sure that you do reverse mapping for the delegate to the file's owner.
Explore the tips that you are looking for. Beauty, Educational, Health, Finance, Resume, Management, Study, Rapid Maths, IELTS, Excel, Diet, Stock Market, Money Saving, How to be Happy, Self Development and many more Tips. Chitka.in has many useful tips that helps you in your daily life.
ReplyDeletequestion seems to be interesting & For More Apps visit here
ReplyDelete