Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ljg93

macrumors member
Original poster
Mar 13, 2011
98
0
Hello I have a applications set up like the Luxor app on the app store. I have three tableviews that a user can scroll through the toolbar to the desired one they wish.

One table is set up on interface builder and the other two I made custom data sources and delegates within NSO object files. So I have a Settings View Controller (where one table is set up in interface builder and the other two tables call their data source and delegates) and then a CustomDataSource.h/.m
and TwoCustomDataSource.h/m

I am trying to get the didSelectRowAtIndexPath methods to work on the custom data source files. I am having trouble with this line of code
Code:
   [[self navigationController] pushViewController:viewController
                                               animated:YES];

It tells me that the the property navigationController is not there. I have the same code used on the settingsTableViewController though.

I tried to make my own navigation controller and do something like

[navController] pushviewController etc and it complies but when i click on the cell of the table view, nothing happens..

Please help me out Thanks!
 
Well, in your XIB. You have View Controllers, Naviation Controllers, Tabcontrollers.
You apparently for your first, have used indeed a navigation controller, and for your second, you used a normal View Controller, try looking in there :)
 
Well, in your XIB. You have View Controllers, Naviation Controllers, Tabcontrollers.
You apparently for your first, have used indeed a navigation controller, and for your second, you used a normal View Controller, try looking in there :)

theres only one view controller for all of it, I am hiding the table views when a user selects a certain button on the toolbar
 
multiple table views on one view

Hello I have three table views on one view that hide and appear when a user touches a tab on the toolbar (NOT TAB BAR).

I am trying to get each cell to go to a specific nib when a row is selected.

For my first tabe which is made in IB it works fine, but the other two tables which are created in code and have outside files as their datasource and delegate do not.

Any ideas?

each delegate for each table all has the following code for the didselectrowatindexpath

Code:
	[tableView deselectRowAtIndexPath:indexPath animated:YES];
	NSMutableString *workoutName = [NSMutableString string];
	[workoutName setString:[[[tableView cellForRowAtIndexPath:indexPath] textLabel] text]];
	[workoutName replaceOccurrencesOfString:@" " withString:@"" options:0 range:NSMakeRange(0, [workoutName length])];
	[workoutName appendFormat:@"ViewController"];
	
	id newViewController = [[objc_getClass([workoutName cStringUsingEncoding:NSUTF8StringEncoding]) alloc] init];
	[self.navigationController pushViewController:newViewController animated:YES];
		NSLog(@"<<< Leaving %s >>>", __PRETTY_FUNCTION__);

Also, do the two data sources for the two table views created in code need to be NSObjects or viewcontrollers? When they are NSObjects the
Code:
	[self.navigationController pushViewController:newViewController animated:YES];

does not work because it is not a property of NSObject.


PLEASE HELP ME OUT!!!!!!
 
THESE are some screenshots
 

Attachments

  • 1.jpg
    1.jpg
    134.4 KB · Views: 100
  • 2.jpg
    2.jpg
    130.5 KB · Views: 100
  • 3.jpg
    3.jpg
    127 KB · Views: 104
  • 4.png
    4.png
    309.1 KB · Views: 97
Didn't you read what I said?
I'm sorry. But you are trying to do a [self navigationController].
you think it appears there magically? You have to tell your super view it's a navigationcontroller (so inside your XIB, it has to say Navigation Controller, or you will never be able to PUSH onto your "non-existing" navigation controller.
 
You are in way above your head.
IN my opinion, you just picked up pieces of code on the internet, trying to sell it as an app, but have no idea what you started. If you don't understand the concept of the basics. then I think it's time to hit the books and redo some work.

I think you are doing some pretty weird ass code. And you need to learn to use the debugger, to help you out
 
Last edited by a moderator:
navigationController is a property of UIViewController. If you are calling [self navigationController] from a class that is not a subclass of UIViewController, you will get the error you are seeing.
 
it actually does say navigation controller. In the xib. if you took a look at the screen shot.

And I did resolve the conflict all I did was set the delegate of the other two table views to the same as the settings but changed the data source.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.