Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Self-Destructing Message iPhone App Using Parse.com as a Backend and Adding Users Logging In and Logging Out

I have major issues here, getting the back button to hide. The back button itself, does not hide, only the arrow.

There is something not going right, I believe with using XCode 6 and targeting iOS 7.1, the hiding of the back button has some issues. I see how the back button now does not have its little arrow, but the back text is still there. it is however not clickable. Furthermore, when you go to signup the back button still exists.

It seems like this bug is only present if you log out, stop running the app, and then run the app. What happens is that the inboxtable redirects to the login screen, and there you can see a back button that does not work but is still visible. I havent seen the subsequent videos so I hope it's being fixed there. If not please let me know how this can be fixed.

Roderick Kar
Roderick Kar
8,456 Points

I am trying to follow this course using Swift. If you look into my question asked in this lesson, you will see if have run into the exact problem. Somehow I have solved it using the steps outlined. Maybe worthwhile for you to try implementing it using objective-c. good luck.

Kevin Hamil
Kevin Hamil
8,203 Points

I would also like to get a little help figuring this out... I'm experiencing the same thing and spent a little time trying Roderick's logic, but to no avail. I can provide more detail, but Dimitri has pretty much explained it.

EDIT: Further testing I see that this problem only occurs for me at the initial login screen (no back arrow, but still showing inactive "Back" text). If I login and then logout, the app works as it should. I'm trying to see if I can figure out how to fix the problem at the initial loading of login screen.

4 Answers

Michiel Lauret
Michiel Lauret
1,202 Points

Instead of disabling the Back button in viewDidLoad in your LoginViewController class, you can also do this in InboxViewController in the method prepareForSegue. Here is the full method in InboxViewController. This solved the bug for me.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"showLogin"]) {
        LoginViewController *lvc = segue.destinationViewController;
        [lvc setHidesBottomBarWhenPushed:YES];
        lvc.navigationItem.hidesBackButton = YES;
    }
}

thank you very much, it worked for me after a hour try to hide back button in login viewcontroller (Using Xcode 6 and iOS8.1) Treehouse need update all course for new Xcode and iOS. :)

thibaut noah
thibaut noah
8,692 Points

This also solve the issue of the button not appearing in the signup view, thanks

Kevin Hamil
Kevin Hamil
8,203 Points

Got it working properly. Not sure if there's a more simplified way to write this, but it worked for me.

InboxViewController *vc = [segue destinationViewController];
[vc setHidesBottomBarWhenPushed:YES];
[vc.navigationItem setHidesBackButton:YES animated:YES];
Gustav Stromfelt
Gustav Stromfelt
5,655 Points

Thanks for this code!!

Works perfectly Kevin

Ryan Summe
Ryan Summe
4,618 Points

This works, however when the app load you see the inbox for a second then transitions to login screen (even with animated:NO). Just looks odd and not ideal.

Darean Wong
Darean Wong
Courses Plus Student 4,186 Points

Yes I agree with Ryan, I too would like to NOT see the inbox if a user is not logged in.

Yücel Karacalar
Yücel Karacalar
3,226 Points

I have the same issue thanks for the answer from Michiel Lauret.

Rashii Henry
Rashii Henry
16,433 Points

Don't know if anyone is still having problems with this issue, but here it is in swift.

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController.

    if (segue.identifier == "desiredSegueName") {
        // you could also use a viewController... but at this current project I used a TabBarViewController
        // don't forget to cast the Viewcontroller
        let destinationVC: TabBarController = segue.destinationViewController as! TabBarController
        destinationVC.navigationItem.hidesBackButton = true

    }



}