UITableView 推送到 URL 帮助
我正在尝试推送到新视图并将 url 发送到该视图中的 webview,但它没有收到 url 请求。 StoryLink 已提前声明,但即使我尝试请求 http://www.google.com 它也不会'甚至都不起作用,所以我知道问题是它由于某种原因不接受网址。
DetailViewController *newviewController=[[[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]autorelease];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:storyLink]];
[newviewController.rssview loadRequest:request];
[self.navigationController pushViewController:newviewController animated:YES];
I am trying to push to a new view and send a url to the webview in that view but it's not getting the url request. storyLink is declared earlier on, but even if I try to request http://www.google.com it doesn't even work either, so I know the problem is it's not accepting the url for some reason.
DetailViewController *newviewController=[[[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]autorelease];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:storyLink]];
[newviewController.rssview loadRequest:request];
[self.navigationController pushViewController:newviewController animated:YES];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好在下一个视图中为 NSURL 声明一个属性,并从父视图中设置该值。
例如,在 DetailViewController.h 文件中设置以下代码 在
DetailViewController.m 文件中...
@合成请求;
并按如下方式修改您当前的代码...
参考您的代码...:
以下是您必须在代码中修改的一些缺失内容,它将开始正常工作。
为 UIWebview 控件设置委托。
在 DetailViewController.h 中,修改以下行。
在 DetailViewController.m 中添加 UIWebview 的委托方法,如下所示...
替换以下代码
Better you declare a property in next view for NSURL and set the value from the parent view.
For example, set following code in your DetailViewController.h file
In your DetailViewController.m file...
@synthesize request;
And modify your current code as below...
In reference to your code...:
Following are some missing things that you have to modify in your code and it will start working fine.
Set delegate for UIWebview control.
In your DetailViewController.h, modify following lines.
In DetailViewController.m add delegate method of UIWebview as given below...
Replace following code in