我有一个UIViewController(位于tabUIController中)。在这个UIViewController中,我想在用户点击按钮时呈现一个modelviewcontroller。我不能让这个工作。使用我的代码(见下文),我进入按下按钮的阶段,但我得到了“无法读取未知加载命令0x80000022”的奇怪错误。
有什么想法吗? (对于BrowserUIViewController我还没有添加任何东西,但它没关系,任何控制器我只想让语法正确)。
@interface AboutDoronUIViewController : UIViewController
<UITableViewDelegate, UITableViewDataSource> {
NSDictionary *values;
NSArray *keys;
BrowserUIViewController *browser;
AboutDoronUIViewController *about;
}
@property (retain, nonatomic) NSDictionary *values;
@property (retain, nonatomic) NSArray *keys;
@property (retain, nonatomic) BrowserUIViewController *browser;
@property (retain, nonatomic) AboutDoronUIViewController *about;
@end
...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger section = [indexPath section];
NSUInteger row = [indexPath row];
NSString *getSection = [keys objectAtIndex:section];
NSArray *valuesForSection = [values objectForKey: getSection];
NSString *selectedLink = [valuesForSection objectAtIndex:row];
NSString *urlAddress = @"http://www.google.com";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; //unused for now
BrowserUIViewController *temp = [[BrowserUIViewController alloc] initWithNibName:@"BrowserUIViewController" bundle:nil];
self.browser = temp;
[self presentModalViewController:browser animated:YES];
[urlAddress release];
[valuesForSection release];
[selectedLink release];
[getSection release];
[temp release];
}
答案 0 :(得分:0)
您在此处的代码看起来是正确的,因此您的问题很可能在其他地方。
尝试在presentModalViewController:animated:
行周围放置断点,以查看在错误发生之前执行的行。
尝试在viewDidLoad
类的viewWillAppear:
和BrowserUIViewController
方法中添加断点,以查看在发生错误之前调用了哪些(如果有)。