我一直在試圖弄清爲什麼後退按鈕不會顯示。在我的tableview(這是動態填充)我有Xcode 6添加後退按鈕
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//NSString *continent = [self tableView:tableView titleForHeaderInSection:indexPath.section];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:
@"Main" bundle:[NSBundle mainBundle]];
UIViewController *myController = [storyboard instantiateViewControllerWithIdentifier:@"EditProfileController"];
[self presentViewController:myController animated:YES completion:nil];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
這工作發現,我可以打開一個名爲EditProfileController視圖。在我的EditProfileController.m我有這
#import "EditProfileController.h"
@interface EditProfileController()
@end
@implementation EditProfileController
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStylePlain target:self action:@selector(Back)];
self.navigationItem.leftBarButtonItem = backButton;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)Back
{
[self dismissViewControllerAnimated:YES completion:nil]; // ios 6
}
@end
我希望看到後退按鈕,但沒有顯示。
這裏是故事板