I'm new at objective c, I was playing with labels buttons and textboxes, I've a label, text box and two buttons(Add, Clear),
what I want to do is, write something in the textbox and when press to "add" button I want the text to appear on the label , and the clear button should clear label and the text box
I've ran the program and the build is succeed however when i write some text and press return button nothing happens, the virtual keyboard still stays there and text doesn't appear on the label, my codes are as follows:
in the .h file
@interface ViewController : UIViewController
@property (retain, nonatomic) IBOutlet UILabel *label;
@property (retain, nonatomic) IBOutlet UITextField *txtbox;
@property (retain, nonatomic) IBOutlet UIButton *btnadd;
@property (retain, nonatomic) IBOutlet UIButton *btnclear;
- (IBAction)btnadd:(id)sender;
- (IBAction)btnclear:(id)sender;
- (IBAction)txtbox:(id)sender;
in the .m file
@implementation ViewController
@synthesize label,txtbox,btnadd,btnclear;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc {
[label release];
[txtbox release];
[btnadd release];
[btnclear release];
[super dealloc];
}
- (IBAction)btnadd:(id)sender {
label.text = (txtbox.text);
}
- (IBAction)btnclear:(id)sender {
txtbox.text=@"";
label.text=@"";
}
- (IBAction)txtbox:(id)sender {
}
@end
I would really appreciate if someone helps, thanks in advance
P.s : what is the code to end the program if incase I add an exit button?
Thanks again,
Asim Gunduz