I am using the b开发者_如何学Celow code; it works but the text appears with few pixels left padding/margin.
How can I remove/adjust the cell padding/margin?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [resultaterTableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.textLabel.text = [resultater objectAtIndex:indexPath.row];
}
Use the custom cell:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Custom";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:cellFrame reuseIdentifier:CellIdentifier] autorelease];
}
CGRect *customframe = CGRectMake(2, 2, 250, 30); **// Set the frame** as per your own.
UILabel *lbl = [[UILabel alloc] initWithFrame:customframe];
lbl.text = [resultater objectAtIndex:indexPath.row]; **// Set the label value from array**
[cell.contentView addSubview:lbl];
[lbl release];
return cell;
}
精彩评论