Opening a View with a Table without a NavigationController
Posted
by Ken
on Stack Overflow
See other posts from Stack Overflow
or by Ken
Published on 2010-04-09T13:57:31Z
Indexed on
2010/04/09
15:03 UTC
Read the original article
Hit count: 585
Hiya,
I'm pretty new to developing with Cocoa Touch/XCode and I came across a problem.
I'm making a sort of RSS reader for a newssite and I have 5 views of tables navigated with 5 tabs in a TabBarController. If someone selects a newsitem I want another view to open showing the complete newsitem. My problem is that it won't work.
This is my code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection(NSInteger)section{
return [[[self rssParser]rssItems]count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"rssItemCell"];
if(nil == cell){
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"rssItemCell"]autorelease];
}
cell.textLabel.text = [[[[self rssParser]rssItems]objectAtIndex:indexPath.row]title];
cell.detailTextLabel.text = [[[[self rssParser]rssItems]objectAtIndex:indexPath.row]description];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[[self appDelegate] setCurrentlySelectedBlogItem:[[[self rssParser]rssItems]objectAtIndex:indexPath.row]];
[self.appDelegate loadNewsDetails];
}
And it calls this method in my delegate:
-(void)loadNewsDetails{
[[self rootController]pushViewController:detailController animated:YES];
}
Please tell me what I'm doing wrong. BTW I do not want to use a NavigationController, just the tabbar I'm using.
Thanks in advance,
Ken
© Stack Overflow or respective owner