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];
[control开发者_运维知识库ler release];
}
compile with error..had imported all the files..wat went wrong?
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?
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]
Try using:
[controller setTitle:[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"Description"];
Try using this:
self->Title //... Your code here
Or try with a method like this:
-(void)setTitle: (NSString*)aTitle;
{
[self->Title setString:aTitle];
}
精彩评论