Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-15-2009, 06:04 PM   #1 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Question didSelectRowForindexPath NavContr - TabBar

I have set up a TabBar with a tab which includes a NavController and a TableView everything is working fine with loading the the tableview with data, but the didSelectRow method is not pushing the view...

Take a look at my code:


Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	
	UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Alert!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
	[myAlert show];
	[myAlert release];
	
	
	
	
	DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
	[self.navigationController pushViewController:dvController animated:YES];
	[dvController release];
	dvController = nil;
	
	
	
}

I have also tried not having the alert there, but the same problem.

When i click at a cell the alert pops up, but the push thing doesnt work. without the alert,, still nothing.

I have set everything correctly up and i have imported DetailViewController.h
And everything, Please help me with this.

Thank You.
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-15-2009, 06:22 PM   #2 (permalink)
Digital Assertion
 
drewag's Avatar
 
Join Date: Aug 2009
Posts: 268
Default

Quote:
Originally Posted by LeopardDevX View Post
I have set up a TabBar with a tab which includes a NavController and a TableView everything is working fine with loading the the tableview with data, but the didSelectRow method is not pushing the view...

Take a look at my code:


Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	
	UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Alert!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
	[myAlert show];
	[myAlert release];
	
	
	
	
	DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
	[self.navigationController pushViewController:dvController animated:YES];
	[dvController release];
	dvController = nil;
	
	
	
}

I have also tried not having the alert there, but the same problem.

When i click at a cell the alert pops up, but the push thing doesnt work. without the alert,, still nothing.

I have set everything correctly up and i have imported DetailViewController.h
And everything, Please help me with this.

Thank You.
Everything there looks fine to me. I can only assume that the navigationController is not connected correctly. Have you tried outputting the navigation controller to make sure it is there?
Code:
NSLog(@"%@",self.navigationController);
__________________
Digital Assertion, LLC
Check out our iPhone apps:
Notecards: Great study tool for anytime anywhere!
Redirect: Addicting puzzle / action game!

Follow Digital Assertion on Twitter: DigAssertion

Follow me on Twitter: Andrew Wagner
drewag is offline   Reply With Quote
Old 08-15-2009, 06:32 PM   #3 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default

Quote:
Originally Posted by drewag View Post
Everything there looks fine to me. I can only assume that the navigationController is not connected correctly. Have you tried outputting the navigation controller to make sure it is there?
Code:
NSLog(@"%@",self.navigationController);
How should it be connected if its not/wrong connected?
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-15-2009, 06:50 PM   #4 (permalink)
Digital Assertion
 
drewag's Avatar
 
Join Date: Aug 2009
Posts: 268
Default

Quote:
Originally Posted by LeopardDevX View Post
How should it be connected if its not/wrong connected?
It seems that there is no way to manually set the navigationController. You have to make sure that the tableview is actually within the navigationcontroller. It is possible that you are simply just showing the tableview on top of the navigation controller or something. Are you doing this through code or through interface builder?
__________________
Digital Assertion, LLC
Check out our iPhone apps:
Notecards: Great study tool for anytime anywhere!
Redirect: Addicting puzzle / action game!

Follow Digital Assertion on Twitter: DigAssertion

Follow me on Twitter: Andrew Wagner
drewag is offline   Reply With Quote
Old 08-15-2009, 06:56 PM   #5 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default

Quote:
Originally Posted by drewag View Post
It seems that there is no way to manually set the navigationController. You have to make sure that the tableview is actually within the navigationcontroller. It is possible that you are simply just showing the tableview on top of the navigation controller or something. Are you doing this through code or through interface builder?
Im setting up the tableview within the NavigationController class files.
So i really dont know whats wrong.


All help is appreachiated.

Thank you
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-15-2009, 07:09 PM   #6 (permalink)
Digital Assertion
 
drewag's Avatar
 
Join Date: Aug 2009
Posts: 268
Default

Quote:
Originally Posted by LeopardDevX View Post
Im setting up the tableview within the NavigationController class files.
So i really dont know whats wrong.


All help is appreachiated.

Thank you
Can you please post the code where you are initializing the navigation controller (if you are doing it with code) and also the code where you are setting up the tableview and adding it to the navigationController?
__________________
Digital Assertion, LLC
Check out our iPhone apps:
Notecards: Great study tool for anytime anywhere!
Redirect: Addicting puzzle / action game!

Follow Digital Assertion on Twitter: DigAssertion

Follow me on Twitter: Andrew Wagner
drewag is offline   Reply With Quote
Old 08-15-2009, 07:15 PM   #7 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Post Title

I do both by IB.
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-15-2009, 08:35 PM   #8 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

You're making it sound like you have a table view inside of a navigation controller.

You probably want one of the following:
1. A table view _controller_ inside of a navigation controller
2. A table view inside of a view controller that is inside of a navigation controller

Which one depends on what else you want the view to do.

Oh, and I think that the bundle: parameter should be nil.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-16-2009, 05:48 AM   #9 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default ?

Quote:
Originally Posted by BrianSlick View Post
You're making it sound like you have a table view inside of a navigation controller.

You probably want one of the following:
1. A table view _controller_ inside of a navigation controller
2. A table view inside of a view controller that is inside of a navigation controller

Which one depends on what else you want the view to do.

Oh, and I think that the bundle: parameter should be nil.
I think i already have number 2 set up, and i changed the bundle: to nil. Nothing Happened. Im really stuck at this, i can send my project to one of you.
Or you can help me out with some more things to try....

Thanks for your time..
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-16-2009, 08:57 AM   #10 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Post a screen shot of your XIB file, or type out what it looks like. Not the view, the listing of items.

And/or, things to verify:

1. Your File's Owner should be set to your DetailViewController class.
2. AFTER you do that, you need to ctrl-drag from File's Owner to the view, and reconnect the view outlet.

Oh, and what exactly are you seeing? Does it just stay on your original screen, or is the new screen blank? If it stays on the original screen, what was the answer to drewag's NSLog question?
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-16-2009, 11:08 AM   #11 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default Here...

Here is a picture of the MyNav (NavController) Connections and of the ViewController inside, connections (Picture 2).

it stays on the screen where the tableview is.





Attached Images
File Type: jpg Bilde 2.jpg (10.8 KB, 0 views)
File Type: jpg Bilde 3.jpg (9.0 KB, 0 views)
__________________
Thank You.

Last edited by LeopardDevX; 08-16-2009 at 11:14 AM.
LeopardDevX is offline   Reply With Quote
Old 08-16-2009, 11:28 AM   #12 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Quote:
Originally Posted by LeopardDevX View Post
it stays on the screen where the tableview is.
Quote:
Originally Posted by BrianSlick View Post
If it stays on the original screen, what was the answer to drewag's NSLog question?
Come on, help me out here...
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-16-2009, 11:39 AM   #13 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default I

I dont know how to use what he posted, so i dont know.
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-16-2009, 11:46 AM   #14 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Code:
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
NSLog(@"NavigationController is: %@",[self navigationController]);
NSLog(@"DetailViewController is: %@", dvController);
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-16-2009, 11:52 AM   #15 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default .

Quote:
Originally Posted by BrianSlick View Post
Code:
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
NSLog(@"NavigationController is: %@",[self navigationController]);
NSLog(@"DetailViewController is: %@", dvController);
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;

Nothing different happens when i add that code, what am i supposed to do?

Sorry for noobiness. im more of a game dev.
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-16-2009, 11:57 AM   #16 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Read the output in console window. Report back what it says.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-16-2009, 12:04 PM   #17 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default

Quote:
Originally Posted by BrianSlick View Post
Read the output in console window. Report back what it says.
It Says:



2009-08-16 18:03:37.548 VG-Topp20[1041:20b] NavigationController is: (null)
2009-08-16 18:03:37.549 VG-Topp20[1041:20b] DetailViewController is: <DetailViewController: 0xd444d0>
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-16-2009, 12:16 PM   #18 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Ok, so that means you don't have a navigation controller. That's your problem.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-16-2009, 03:45 PM   #19 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Question .

Quote:
Originally Posted by BrianSlick View Post
Ok, so that means you don't have a navigation controller. That's your problem.
But everything is created in the MyNav wich is a UINavigationContr. class.

See:

@interface MyNav : UINavigationController


Can anyone help me do this right?
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-16-2009, 04:47 PM   #20 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default N

"bump"

Im sorry i really need help with this.
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-16-2009, 04:59 PM   #21 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

From the UINavigationController documentation:

Quote:
This class is not intended for subclassing.
Create a new project, based on the 'Navigation-based Application' template. Look at what gets created. Make changes to your program accordingly.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-17-2009, 04:24 AM   #22 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default

Quote:
Originally Posted by BrianSlick View Post
From the UINavigationController documentation:



Create a new project, based on the 'Navigation-based Application' template. Look at what gets created. Make changes to your program accordingly.
I dont know what to do.
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-17-2009, 04:38 AM   #23 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default now

I now sit with a new nib for the table and the original for the navController inside the TabBar and loads its view from the new nib.
The tableview works fine and loads nice, but now theres no navBar to see and the pushView doesnt work either.
Can anyone help me with this?
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Old 08-17-2009, 09:41 AM   #24 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

This is what it should look like:



How close to that are you?
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 08-17-2009, 10:05 AM   #25 (permalink)
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Default This

This close....


__________________
Thank You.
LeopardDevX is offline   Reply With Quote
Reply

Bookmarks

Tags
navigationcontroller, pushviewcontroller, tabbar, tableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 247
21 members and 226 guests
ADY, bookesp, ckgni, dacapo, Dani77, DarkAn, Davey555, Desert Diva, HemiMG, iDifferent, jakerocheleau, JasonR, LEARN2MAKE, nobre84, prchn4christ, Rudy, ryantcb, Speed, themathminister, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,766
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:40 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0