我有一个带标签的应用,我会从表格列表中加载页面详细信息。
在我的appDelegate.m中,我有以下功能:
@synthesize DetailController = _DetailController;
-(void)loadDetails{
[[self navigationController]pushViewController:_DetailController animated:YES];
}
我从view firstviewController调用
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[[self appDelegate] setCurrentlySelectedBlogItem:[[[self rssParser]rssItems]objectAtIndex:indexPath.row]];
[[self appDelegate] loadDetails];
}
但请勿更改视图。为什么呢?
在我的appDelegate.h
中#import <UIKit/UIKit.h>
@class FirstViewController;
@class DetailViewController;
@class RSSEntry;
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>{
UIWindow * _window;
FirstViewController * _viewController;
UINavigationController * _navigationController;
DetailViewController * _DetailController;
RSSEntry * _currentlySelectedBlogItem;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UITabBarController *tabBarController;
@property (nonatomic, strong) IBOutlet FirstViewController *viewController;
@property (nonatomic, strong) IBOutlet UINavigationController * navigationController;
@property (nonatomic,strong) IBOutlet DetailViewController * DetailController;
@property (readwrite,strong) RSSEntry * currentlySelectedBlogItem;
-(void)loadDetails;
@end