summer
summer

Reputation: 269

request for member 'title' not a structure or union?

    #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?

Upvotes: 0

Views: 580

Answers (4)

Alex
Alex

Reputation: 363

Try using this:

self->Title //... Your code here

Or try with a method like this:

 -(void)setTitle: (NSString*)aTitle;
{
    [self->Title setString:aTitle];
}

Upvotes: 0

Grant Paul
Grant Paul

Reputation: 5902

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?

Upvotes: 3

mjdth
mjdth

Reputation: 6536

Try using:

[controller setTitle:[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"Description"];

Upvotes: 1

mr-sk
mr-sk

Reputation: 13407

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]

Upvotes: 1

Related Questions