基于导航的模板存在问题
大家好,
我正在创建一个基于导航的应用程序我正在以编程方式设计屏幕,我需要有 2 个栏按钮,即左栏按钮项目和左栏按钮项目。右栏按钮项目,所以我在 - (void)loadView 方法中使用了以下代码,但是当控制器进入 loadview 方法时它崩溃了,谁能告诉我这段代码出了什么问题,提前谢谢
self.title = @"Add Item";
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self action:@selector(cancel_Clicked:)] autorelease];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemSave
target:self action:@selector(save_Clicked:)] autorelease];
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
hii every one
i am creating a navigation based application & i am designing screens programatically , i need to have 2 bar buttons ie left barbutton item & right bar button item so i have used following code in - (void)loadView method but its crashing when controller enters loadview method,,can any one tell me whats wrong in this code, thanx in advance
self.title = @"Add Item";
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self action:@selector(cancel_Clicked:)] autorelease];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemSave
target:self action:@selector(save_Clicked:)] autorelease];
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个代码
Try this code
尝试以下代码,
以相同的方式创建 rightBarButtonItem
Try following code,
same way create for rightBarButtonItem