views:

181

answers:

5
    #import "RootViewController.h"
    #import "DetailViewController.h"

    @implementation RootViewController


    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath      *)indexPath {
    // UITableViewStyleGrouped table view style will cause the table have a textured background
    // and each section will be separated from the other ones.
    DetailViewController *controller = [[DetailViewController alloc]
                                        initWithStyle:UITableViewStyleGrouped
                                        andfileData:[dao   libraryItemAtIndex:indexPath.row]];
    controller.title = [[dao libraryItemAtIndex:indexPath.row] valueForKey:@"Description"];
    [self.navigationController pushViewController:controller animated:YES];
    [controller release];
} 

compile with error..had imported all the files..wat went wrong?

+1  A: 

Is the controller being init'd properly? Did you check if its null or something's wrong? Put a breakpoint on it and check it out:

 DetailViewController *controller = [[DetailViewController alloc]
Mr-sk
+1  A: 

Try using:

[controller setTitle:[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"Description"];
mjdth
If the first code isn't working, this code looks dangerous.
chpwn
+3  A: 

Actually, I'm guessing that the controller object (of class DetailViewController) doesn't actually have the property "title" as is needed for the "dot-syntax" to work.

Does DetailViewController properly inherit from UIViewController?

chpwn
Carson: Yea, make sure that DetailViewController is inheriting from UIViewController (NOT UIView). That error generally means that there's no property with the given name and you didn't include the interface definition for DetailViewController, so we have no way of knowing what the problem is.
Nimrod
A: 

nop..it wasnt inherit from uiview..and the above code isn't working either..gosh!

summer
summer, please don't post comments as answers. Can you delete this and add a comment to the appropriate answer?
gerry3
A: 

// compile with error..had imported all the files..wat went wrong?

Could you please paste the error message?

Xie Wei
its the same error as mentioned above
summer
now that i have everything compile without errors..i can't seems to select the row with the following which says "Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (1) beyond bounds (1)'"
summer