В iOS 7 веб-просмотр в tableview не отображается, где он отлично работает в iOS 5. В iOS 7 создан образец приложения, которое содержит веб-просмотр в виде таблицы. , После долгого поиска я обнаружил, что это может быть связано с распознавателями жестов, Webview в tableview не отображается. Я протестировал этот сценарий в своем примере приложения. Но он отлично работает. Так что никаких проблем с распознавателями жестов.webview в tableview не отображается в iOS 7
Любая идея, почему webview в tableview не отображается в iOS 7?
Это код для проверки:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [app.resultsDic count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return [NSString stringWithFormat:@"%d",section];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 150;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UIWebView *webView ;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] ;
}
NSUInteger row = [indexPath section];
if ([app.resultsDic count]>0)
{
NSArray *cellSubviews = [cell subviews];
for (UIView *currSubView in cellSubviews) {
[currSubView removeFromSuperview];
}
webView = [[UIWebView alloc] initWithFrame:CGRectMake(15, 8, 280, 140)];
webView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.jpg"]];
[cell addSubview:webView];
//Retrieving Data into Dictionary and formatting the data using htmlString
NSDictionary *resDict = [app.resultsDic valueForKey:[NSString stringWithFormat:@"%d",row]];
NSMutableString *htmlString = [[NSMutableString alloc] init];
NSString *initialString = [NSString stringWithFormat:@"<table>"];
NSString *endString = [NSString stringWithFormat:@"</table>"];
[htmlString appendString:initialString];
for (int e = 0 ; e < [[resDict allKeys] count]; e++) {
NSString *currentKey = [[resDict allKeys] objectAtIndex: e];
[htmlString appendFormat:@"<tr><td ><b>%@</b></td><td>:</td><td><font color=DarkBlue>%@</font></td></tr>", currentKey,[resDict objectForKey:currentKey]];
}
[htmlString appendString:endString];
NSString *cssString=[NSString stringWithFormat:@"table { width:100%; font-size:12px;font-family:Verdana}"];
NSString *htmlString1 = [NSString stringWithFormat:@"<html> <head> <style type=\"text/css\"> %@ </style> </head> <body> %@ </body> </html>", cssString, htmlString];
[webView loadHTMLString:htmlString1 baseURL:nil];
[webView.scrollView setBounces:NO];
}
return cell;
}
Благодаря
WebView в виде таблицы, в том смысле, который вы загружаете веб-просмотра в каждой из ячеек правой? – Ganapathy
обновите свой вопрос с помощью своего точного кода. – Ganapathy
Другое, тогда IOS 7 во всей другой версии, является загрузка контента на всей веб-странице? – Ganapathy