#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
SEL action = NSSelectorFromString(@"click:");
SEL action1 = @selector(click:);
[self createButtonWithFrame:self.window.bounds title:@"aa" bgColor:[UIColor redColor] action:action1];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
- (void)createButtonWithFrame:(CGRect)frame title:(NSString *)title bgColor:(UIColor *)bgColor action:(SEL)actionName
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.frame = frame;
btn.backgroundColor = bgColor;
[btn setTitle:title forState:UIControlStateNormal];
[btn addTarget:self action:NSSelectorFromString(actionName) forControlEvents:UIControlEventTouchUpInside];
[self.window addSubview:btn];
}