在我的项目(“Xcode 4.3.2 - 单一视图应用程序”)中,我手动添加了一个带有按钮项目的工具栏,我需要以编程方式更新按钮标签。 我该怎么做?你可以帮我吗?xCode - 工具栏按钮项目标签更改
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController <UIWebViewDelegate>{
IBOutlet UIWebView *webDisplay;
IBOutlet UIToolbar *menuBar; //my toolBar
}
@property(nonatomic,retain) UIWebView *webDisplay;
@property(nonatomic,retain) UIToolbar *menuBar;
- (IBAction) changeLabel:(id)sender;
@end
ViewController.m
- (IBAction) changeLabel:(id)sender{
//code for updating label
}
可能重复http://stackoverflow.com/questions/1225457/change-the-text-of-a-uilabel-uibarbuttonitem -on-a-toolbar-programmatically) – Gray 2012-04-11 13:05:42