這裏我們創建一個single view app,配置如下
#import "ViewController.h"
@interface ViewController ()
@property(nonatomic,weak) IBOutlet UIButton *btn1;
-(IBAction) btnPressed: (UIButton*) sender;
@end
@implementation ViewController
-(IBAction)btnPressed:(UIButton *)sender
{
[self.btn1 setTitle:@"被點擊了" forState:UIControlStateNormal];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
此時storyboard的界面如下,這裏的代碼做的是當我們點擊時,按鈕的title就會變成被點擊了,我們來試試看那麼我們的入門教程就到這裏來,我是菜鳥,多多指教,DRW