我有一个带有标签的应用程序,我会从表格列表中加载页面详细信息。
在我的 appDelegate.mi 中具有以下功能:
@synthesize DetailController = _DetailController;
-(void)loadDetails{
[[self navigationController]pushViewController:_DetailController animated:YES];
}
我从视图 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