Skip to content

Instantly share code, notes, and snippets.

@jweinberg
Created December 23, 2010 22:47
Show Gist options
  • Save jweinberg/753650 to your computer and use it in GitHub Desktop.
Save jweinberg/753650 to your computer and use it in GitHub Desktop.
#import <UIKit/UIKit.h>
@interface MyAwesomeView : UIView
{
UILabel *textLabel;
UIButton *button;
NSUInteger counter;
}
- (IBAction)incrementCount:(id)sender;
@property (nonatomic, retain) IBOutlet UILabel *textLabel;
@end
#import "MyAwesomeView.h"
@interface MyAwesomeView ()
- (void)updateDisplay;
@end
@implementation MyAwesomeView
@synthesize textLabel;
- (void)dealloc;
{
[textLabel release], textLabel = nil;
[button release], button = nil;
[super dealloc];
}
- (void)awakeFromNib;
{
[self updateDisplay];
}
- (IBAction)incrementCount:(id)sender;
{
counter += 1;
[self updateDisplay];
}
- (void)updateDisplay;
{
[self.textLabel setText:[NSString stringWithFormat:@"%d", counter]];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment