I am unsure why this code will not work and what i want it to do is when i click a button(action: buttonclick) i want it to change the two text box's(MyTextLabel & MyTextLabel2) text increment the value "r" by one. here is the code:
MainView.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface MainView : UIView {
IBOutlet UIButton *MyButton;
IBOutlet UILabel *MyTextLabel;
IBOutlet UILabel *MyTextLabel2;
}
@property (nonatomic, retain) UIButton *MyButton;
@property (nonatomic, retain) UILabel *MyTextLabel;
@property (nonatomic, retain) UILabel *MyTextLabel2;
- (IBAction)buttonclick;
@end
MainView.m:
#import "MainView.h"
#include <stdlib.h>
#include <libc.h>
@implementation MainView
@synthesize MyButton, MyTextLabel, MyTextLabel2;
int r;
- (IBAction)buttonclick {
r++
if(r < 50) {
MyTextLabel.text = @"< 50";
} else {
MyTextLabel2.text = @"=> 50";
}
}
@end