標籤:c style class blog code java
一、點擊UINavigationBar中的UIBarButtonItem,改變UILabel中的文本,01,02,03
圖01圖02圖03
二、項目步驟:
1、選擇Simple View Aplication,取名cq.40.UINavigationBar,04
圖04
2、Main.storyboard,05
3、CQ40ViewController.h
#import <UIKit/UIKit.h>@interface CQ40ViewController : UIViewController@property (weak,nonatomic) IBOutlet UILabel *label;- (IBAction)save:(id)sender;- (IBAction)add:(id)sender;@end
4、CQ40ViewController.m
#import "CQ40ViewController.h"@interface CQ40ViewController ()@end@implementation CQ40ViewController- (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.}- (IBAction)save:(id)sender{ self.label.text = @"click Save";}- (IBAction)add:(id)sender{ self.label.text = @"click Add";}@end