【发布时间】:2012-03-09 20:42:45
【问题描述】:
这周我开始学习 ios 编码,但我遇到了一个奇怪的错误
我做了一个小脚本,在主页上有一个由UITableView 组成的名称列表,当有人选择一行时,它会打开相对 URL,但是当加载网页时出现问题
该网页有类似“UITableView”的行。
你知道为什么会产生这种错误吗?
这就是它所产生的;
更新 我已经重新编写了我的应用程序,但问题仍然存在,我不明白为什么在网页上显示行
在 rootviewcontroller.m 中我调用了 WebPage 类
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSDictionary *Game = [[self.Sections valueForKey:[[[self.Sections allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
[tableView deselectRowAtIndexPath:indexPath animated:YES]; //svanisce il blu
NSLog(@"%@", [[self.Games objectAtIndex:indexPath.row ] objectForKey:@"Url"]); // funge
WebPage *newWeb = [[WebPage alloc] init];
newWeb.theUrl = [NSURL URLWithString:[Game objectForKey:@"Url"]];
[self.navigationController pushViewController:newWeb animated:YES];
}
就是WebPage.h
#import <UIKit/UIKit.h>
@interface WebPage : UITableViewController <UIWebViewDelegate> {
UIWebView *webView;
NSURL *theUrl;
}
@property (nonatomic, retain) NSURL *theUrl;
@property (nonatomic, retain) UIWebView *webView;
@end
那就是 WebPage.m
#import "WebPage.h"
@implementation WebPage
@synthesize theUrl;
@synthesize webView;
- (void)viewDidLoad
{
[super viewDidLoad];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0, self.view.bounds.size.width, self.view.bounds.size.height)];
webView.delegate = self;
webView.scalesPageToFit = YES;
[webView loadRequest:[NSURLRequest requestWithURL:theUrl]];
[self.view addSubview:webView];
}
@end
【问题讨论】:
-
显示你的
didSelectRowAtIndexPath方法,你如何启动webview。 -
是的,请更新您的代码,以便我们提出修改建议。
-
而
web是什么类?对于tableview,你设置了特殊的绘图选项吗? -
我已经修改了我的帖子,添加了有关该问题的所有信息你知道如何解决它吗?
-
看来我已经用
self.tableView.separatorColor = [UIColor clearColor];解决了它
标签: uitableview ios5 uiwebview