问题描述
在demo的基础上改界面需求,发现申请前与通知返回按钮不见了,我看了代码有设置,但不起作用,找不出原因
解决方案
您把相关代码发上来一下,一般这种情况,是UI出现的问题!
解决方案二:
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; [backButton setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal]; [backButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton]; [self.navigationItem setLeftBarButtonItem:backItem];这是设置导航栏上返回按钮的代码,您仔细检查一下,是否出现错误
解决方案三:
是啊,是这样设置的
解决方案四:
您的工程中[UIImage imageNamed:@"back.png"] 有back.png这张图片吗? 您点击左上角的时候,是不是也可以跳转页面呢?
解决方案五:
我注释掉导航栏的代码,点击左边区域也能返回的,
解决方案六:
// Uncomment the following line to preserve selection between presentations. self.title = NSLocalizedString(@"title.apply", @"Application and notification"); self.tableView.tableFooterView = [[UIView alloc] init]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; [backButton setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal]; [backButton addTarget:self.navigationController action:@selector(popViewControllerAnimated:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton]; [self.navigationItem setLeftBarButtonItem:backItem]; [self loadDataSourceFromLocalDB];
解决方案七:
addTarget:self.navigationController 改成addTarget:self 试一试