简体   繁体   中英

Back button doesnt work in ios 7

I'm using this code in all ViewControllers to create back button:

self.btnBack = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];
[self.btnBack setBackgroundImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
[self.btnBack addTarget:self action:@selector(cancel:) forControlEvents:UIControlEventTouchUpInside];

-(void)cancel:(id)sender 
{
    [self.navigationController popViewControllerAnimated:YES];   
}

But when I go to controller with UIWebView I need top tap 2 times to go back in ios 6. And in ios 7 when I tap 1 time UIWebView disappeared show black screen with my navigation and on 2nd tap app crashes.

In all screen this works great maybe something special with UIWebView , I dont know. Help please!

I push webview:

-(IBAction)doPrivacy:(id)sender 
{
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    WebPageViewController *web = (WebPageViewController*)[storyBoard instantiateViewControllerWithIdentifier:@"WebPage"];

    web.hidesBottomBarWhenPushed = YES;
    web.urlToOpen = @"http://dfdfdf.co";

    [self.navigationController pushViewController:web animated:YES];
}

I'm calling the same segue twice, you can fix this by unlinking the connection from the CELL DIRECTLY, to your segue, and having the segue connection originate at the top of the table hierarchy in IB, rather than nested inside the cell. Connect the segue from you View Controller itself, to the segue. If you have done this correct, when you select the segue, it should highlight the ENTIRE view it is coming from, not just the cell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM