iphone中的tableview问题 [英] issue with tableview in iphone

查看:106
本文介绍了iphone中的tableview问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITableView ,它设置了属性 Grouped 。它看起来像带有圆边。这很棒。

I have a UITableView which has set the property Grouped.And it looks like this with rounded edges. And it's great.

一旦我开始滚动 UITabelView ,圆边就会消失,看起来像这样:

As soon I start scrolling the UITabelView the round edges dissappear and it looks like this:

圆边消失!

我应该如何继续操作,当我滚动 UITableView 时圆形边缘保留在第一张图片中?

How should I proceed that and when I scroll the UITableView up and down the round edges are kept as in the first picture?

所询问的相关代码:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
     return 1;
}

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
     return [nameCatalog count];
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];

        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.backgroundColor = [UIColor clearColor];
        cell.selectionStyle = UITableViewCellSelectionStyleGray;
        cell.backgroundView.opaque = NO;

        cell.textLabel.backgroundColor = [UIColor clearColor];
        cell.textLabel.opaque = NO;
        cell.textLabel.textColor = [UIColor whiteColor];
        cell.textLabel.highlightedTextColor = [UIColor whiteColor];
        cell.textLabel.font = [UIFont boldSystemFontOfSize:18];

        cell.detailTextLabel.backgroundColor = [UIColor clearColor];
        cell.detailTextLabel.opaque = NO;
        cell.detailTextLabel.textColor = [UIColor whiteColor];
        cell.detailTextLabel.highlightedTextColor = [UIColor whiteColor];
        cell.detailTextLabel.font = [UIFont systemFontOfSize:14];
    }

    [[cell textLabel] setText:[[nameCatalog objectAtIndex:indexPath.row] valueForKey:@"name"]];
    return cell;
}



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    NSString *escapedString = [[[nameCatalog objectAtIndex:indexPath.row] valueForKey:@"url"]      stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url=[NSURL URLWithString:escapedString];

    [webView loadRequest:[NSURLRequest requestWithURL:url]];


    [self.view addSubview:webView];
    [self.navigationController pushViewController:webView animated:YES];
    [webView setHidden:NO];
    UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] 
                                   initWithTitle:@"Retour" style:UIBarButtonItemStyleBordered target:self action:@selector(tableRetour:)];

    self.navigationItem.leftBarButtonItem = infoButton;
    [self.view addSubview:webView];

}


推荐答案

那是因为在第一张图片中,您看到分组tableView中的顶行是圆形的,但只有顶行和底行是这样的圆形,因此当您滚动时,您会看到正常的中间行。

That's because in the first picture you are seeing the top row in the grouped tableView which is rounded, but only the top and bottom rows are rounded like that, so when you scroll you are seeing the middle rows which is normal.

这篇关于iphone中的tableview问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆