जब मैं UITableViewCells backgroundColor
को सेमी-पारदर्शी रंग में सेट करता हूं, तो यह अच्छा लगता है, लेकिन रंग पूरे सेल को कवर नहीं करता है।UITableViewCell पारदर्शी पृष्ठभूमि (imageView/accessoryView सहित)
imageView
और accessoryView
के आसपास के क्षेत्र सेल की backgroundColor
के रूप में एक ही रंग होने के लिए
मैं स्पष्ट रूप से cell.accessoryView.backgroundColor
और cell.imageView.backgroundColor
स्थापित करने की कोशिश की है [UIColor clearColor]
के रूप में आ रहे हैं ..., लेकिन यह काम नहीं करता यह आइकन के चारों ओर एक छोटा सा बॉक्स रखता है, लेकिन बाएं किनारे को भरने के लिए विस्तार नहीं करता है। दायां किनारा इस से अप्रभावित लगता है।
मैं इसे कैसे ठीक कर सकता हूं?
संपादित:
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
cell.opaque = NO;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor colorWithRed:.1 green:.1 blue:.1 alpha:.4];
cell.textColor = [UIColor whiteColor];
}
cell.imageView.image = [icons objectAtIndex:indexPath.row];
cell.textLabel.text = [items objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
वास्तव में मुझे 1 और चीज करना पड़ा। Cell.textLabel.background रंग को * सेल के पृष्ठभूमि रंग के बाद * सेट करने की आवश्यकता है। मुझे नहीं पता कि मुझे ऐसा करने की ज़रूरत क्यों है, लेकिन अब यह काम कर रहा है। धन्यवाद माइक! –