首页 > 代码库 > iOS.UIKit.09.UINavigationBar
iOS.UIKit.09.UINavigationBar
一、点击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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。