//ViewBasedAppDelegate.h
#import
@class ViewBasedViewController;
@interface ViewBasedAppDelegate : NSObject
UIWindow *window;
}
@property (nonatomic, retain) UIWindow *window;
-(void) catchButton;
@end
//ViewBasedAppDelegate.m
#import "ViewBasedAppDelegate.h"
@implementation ViewBasedAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(10.0, 90.0, 160.0, 40.0);
[button setTitle:@"Button" forState:UIControlStateNormal];
[button addTarget:(id)self action:@selector(catchButton)
forControlEvents:UIControlEventTouchUpInside];
[window addSubview:button];
[window makeKeyAndVisible];
}
- (void)catchButton{
NSLog(@"button pressed");
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end
1 comment:
Thx, I got a simple lesson
Post a Comment