viewDidLoad 没有被 UIViewController 调用被推送
我试图在单击表行时启动 UIViewController...
代码是主视图控制器是...
- (void)showDetail:(NSString *)detail
{
DetailViewController *secondViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:secondViewController animated:YES];
[DetailViewController release];
}
我在附加到 NIB 的“DetailViewController”类中填写了 viewDidLoad 方法。
- (void)viewDidLoad:(BOOL)animated;
{
NSURL *url = [NSURL URLWithString:@"www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}
当我点击 PushViewController 方法时,NIB 似乎已加载(可以看到其上的测试标签),但未调用 viewDidLoad 方法。在该方法中,我尝试将测试 HTML 加载到 UIWebView 中。
有什么想法吗?
I'm trying to launch a UIViewController when a table line is clicked...
The code is main view controller is ...
- (void)showDetail:(NSString *)detail
{
DetailViewController *secondViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:secondViewController animated:YES];
[DetailViewController release];
}
I filled in the viewDidLoad method in my "DetailViewController" class that is attached to the NIB.
- (void)viewDidLoad:(BOOL)animated;
{
NSURL *url = [NSURL URLWithString:@"www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}
When I hit the pushViewController method, the NIB appears to load (can see a test label on it) but the viewDidLoad method is not called. In that method, I'm trying to load a test HTML into a UIWebView.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有事件 viewDidLoad:更改为下面的内容应该可以工作。
There is no event viewDidLoad: change to the bellow it should work.