PDA

View Full Version : Table View Whats Wrong?




iLoveDeveloping
Nov 15, 2009, 10:44 AM
Removed code as i got it working... :p



MacDonaldsd
Nov 15, 2009, 12:52 PM
Might not be your problem, but if you are comparing 2 string you should be using isEqualToString: not isEqual:




- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

if ([[tableList objectAtIndex:indexPath.row] isEqual:@"First View"])

Darkroom
Nov 15, 2009, 01:17 PM
#import "SecondViewController.h"


?

iLoveDeveloping
Nov 15, 2009, 01:20 PM
Might not be your problem, but if you are comparing 2 string you should be using isEqualToString: not isEqual:




- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

if ([[tableList objectAtIndex:indexPath.row] isEqual:@"First View"])

Thanks

PhoneyDeveloper
Nov 15, 2009, 02:25 PM
Open up the debugger console in Xcode. What does it say about the run time exception that you're getting?

iLoveDeveloping
Nov 15, 2009, 02:49 PM
Open up the debugger console in Xcode. What does it say about the run time exception that you're getting?


"0x0081f004 <+0004> leave"?


not really sure how to use that?

What do i look at there are 3 windows?

PhoneyDeveloper
Nov 15, 2009, 05:06 PM
I don't think you've opened the debugger console. From the menu bar choose Run > Console. If your code uses NSLog or printf that's where the output goes. And when you have a run time exception some output is printed there that tells what kind of error you've encountered.

iLoveDeveloping
Nov 15, 2009, 05:52 PM
I don't think you've opened the debugger console. From the menu bar choose Run > Console. If your code uses NSLog or printf that's where the output goes. And when you have a run time exception some output is printed there that tells what kind of error you've encountered.

Oh my bad sorry, it says

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "ThirdViewController" nib but the view outlet was not set.'"'

HMMM...? i found that the third view was names ThirdView NOT ThirdViewController like it should have, fixed the first error i got, then i got this! So i made a new XIB and now it seem its not set with an outlet. How do i do that?

PhoneyDeveloper
Nov 15, 2009, 07:04 PM
UIViewController has a built in IBOutlet called view. You need to set the value of that outlet in IB. Set it to the top level view in the nib.

You can view all the outlets set for your File's Owner by control-click on the file's owner in the nib. Make sure your nib window is set to list view. You'll see a little black window that shows all the outlets and some other stuff.

sneha
Nov 16, 2009, 02:35 AM
there are mainly:rolleyes: two reasons to get that error :

1. You have not given File Owner the UIViewController class (By default it comes in 3.0. You need to set it in 2.2)
2. You have not made the connection with the View properly.

Check your file owners connections properly .

:)

iLoveDeveloping
Nov 21, 2009, 07:16 AM
Ok i got it up and running and it works great, i just rewrote the whole thing, must have just been a missing connection or something cos it worked first time now!! :)

Anyway, one last question, is it at al possible t change the colours of the top bar in a table view, right now its the default 'blue' i hate that, i want my app to look a little more interesting, can i change that? how would i do that if its possible?
Or can i change the colour of the cells??

Thanks for all the help guys!! ;)

dejo
Nov 21, 2009, 01:14 PM
Anyway, one last question, is it at al possible t change the colours of the top bar in a table view, right now its the default 'blue' i hate that, i want my app to look a little more interesting, can i change that? how would i do that if its possible?
Or can i change the colour of the cells??
There are two simple ways to change your navBar's style/color: 1) barStyle property, or 2) tintColor property.

P.S. Please don't edit your OP and replace it with a "fixed" post. That kinda removes the impetus of the entire thread.

iLoveDeveloping
Nov 21, 2009, 01:43 PM
There are two simple ways to change your navBar's style/color: 1) barStyle property, or 2) tintColor property.

P.S. Please don't edit your OP and replace it with a "fixed" post. That kinda removes the impetus of the entire thread.

Thanks, found that in the documentation!! Thanks for all the help... :)