直接上代码:
UIButton *aButton = [UIButton buttonWithType: UIButtonTypeCustom];
aButton.frame = CGRectMake(0, 0, 150, 100);
aButton.center = self.window.center;
[aButton setTitle:@"click" forState:UIControlStateNormal];
[aButton setTitle:@"gui" forState:UIControlStateHighlighted];
[aButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal] ;
[aButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted] ;
aButton.titleLabel.font = [UIFont systemFontOfSize:45];
aButton.showsTouchWhenHighlighted = YES ;
[self.window addSubview:aButton];
[aButton addTarget:self action:@selector(handleButtonAction:) forControlEvents:UIControlEventTouchDown];