5

problem with tableview at iphone

 2 years ago
source link: https://www.codesd.com/item/problem-with-tableview-at-iphone.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

problem with tableview at iphone

advertisements

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

96HMR.png

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

P0w5h.png

The round edges disappear!

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

The relevant code as asked:

- (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];

}


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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK