09-13-2010, 11:42 AM
#1 (permalink )
Registered Member
Join Date: Aug 2010
Posts: 13
What is called when the back button is clicked?
I have a view controller with a table view in it, there is a UIView that i am setting alpha = 0.0 on when I choose a section in the tableview, I want that UIView to come back when you get to the root view. I am trying viewDidAppear, but it only works on the tab buttons, not with the back button on the navigation controller.
Any suggestions?
thanks,
v3
09-13-2010, 11:46 AM
#2 (permalink )
Emphasizing Fundamentals
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
Quote:
Originally Posted by
v3interactive
. I am trying viewDidAppear, but it only works on the tab buttons, not with the back button on the navigation controller.
Incorrect.
09-13-2010, 11:50 AM
#3 (permalink )
Registered Member
Join Date: Aug 2010
Posts: 13
Quote:
Originally Posted by
BrianSlick
Incorrect.
TabBar is subclassed, do you think that could have something to do with it? I am putting a NSLog in the view controller that I am interested in's viewDidAppear and it does NOT show up when I hit the back btn.
09-13-2010, 11:51 AM
#4 (permalink )
Emphasizing Fundamentals
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
viewDidLoad won't fire again unless the view was unloaded.
09-13-2010, 11:52 AM
#5 (permalink )
Registered Member
Join Date: Aug 2010
Posts: 13
Quote:
Originally Posted by
BrianSlick
viewDidLoad won't fire again unless the view was unloaded.
Sorry I mistyped there, I meant viewDidAppear.
09-13-2010, 11:53 AM
#6 (permalink )
Emphasizing Fundamentals
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
Then you have either mis-typed that method name, or you have something set up incorrectly with your view/controller structure.
09-13-2010, 11:56 AM
#7 (permalink )
Registered Member
Join Date: Aug 2010
Posts: 13
Quote:
Originally Posted by
BrianSlick
Then you have either mis-typed that method name, or you have something set up incorrectly with your view/controller structure.
-(void)viewWillAppear
BOOL)animated {
//[super viewWillAppear:NO];
NSLog(@"view will appear");
}
-(void)viewDidAppear
BOOL)animated {
[super viewDidAppear:NO];
NSLog(@"view did appear");
}
Do you see anything wrong with those that I am missing?
Thanks for your replies...
09-13-2010, 11:57 AM
#8 (permalink )
Emphasizing Fundamentals
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
Use the CODE tags.
Those look correct, so it must be a problem with your view structure.
09-13-2010, 12:03 PM
#9 (permalink )
Registered Member
Join Date: Aug 2010
Posts: 13
Quote:
Originally Posted by
BrianSlick
Use the CODE tags.
Those look correct, so it must be a problem with your view structure.
that is the loadView from the VC in question. Each section on the tab bar has its own UINavigationController. Am I doing this the wrong way?
Code:
-(void) loadView {
NSLog(@"loadView");
UINavigationController * nav = [[UINavigationController alloc] initWithNibName:nil bundle:nil];
[self setNavController:nav];
nav.navigationBar.tintColor = [UIColor grayColor];// colorWithRed:0.3176f green:0.3568f blue:0.3647f alpha:1.0f];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = CGRectMake(0.0, 0.0, 320.0, 44.0);
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], (id)[[UIColor colorWithRed:0.7843 green:0.7843 blue:0.7843 alpha:1.0] CGColor], nil];
[[[nav navigationBar] layer] insertSublayer:gradient atIndex:0];
[nav release];
MainNavTableViewController * main = [[MainNavTableViewController alloc] initWithStyle:UITableViewStylePlain];
[[self navController] setViewControllers:[NSArray arrayWithObjects:main, nil]];
[main release];
[[navController view] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"green_background.png"]]];
[self setView:[navController view]];
logOutBar = [[UIView alloc] initWithFrame:CGRectMake(0.0, 386.0, 320.0, 60.0)];
UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logout_bar.png"]];
[logOutBar addSubview:img];
[logOutBar setOpaque:YES];
[img release];
[[self view] addSubview:logOutBar];
//[logOutBar release];
logOutBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[logOutBtn setFrame:CGRectMake(200.0, 386.0, 70, 30.0)];
[logOutBtn setTitle:@"" forState:UIControlStateNormal];
[logOutBtn addTarget:self action:@selector(logout:) forControlEvents:UIControlEventTouchUpInside];
[logOutBtn setOpaque:YES];
[[self view] addSubview:logOutBtn];
}
09-13-2010, 01:09 PM
#10 (permalink )
Emphasizing Fundamentals
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
Navigation controllers contain view controllers. You are doing this backwards.
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 339
14 members and 325 guests
Absentia , cgokey , fiftysixty , givensur , heshiming , iGamesDev , linkmx , michaelhansen , mraalex , PixelInteractive , raihan.zbr , Sloshmonster , Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38