iphone - Problem with transparent text background in UITableView -


I have a nervous problem in my tableview, in getting color-changing cells (blue / white / blue / ...) Was able, but now I am troubled with my text, in which there is a white background on blue cells.

I 'tried to test the background color to be set in red:

  // Try to set the background color of the text ?? ? Cell.textLabel.text.backgroundColor = [UIColor redColor];  

that does not work; Hmph.

Please take a look at my code below; Can anyone tell me what is wrong and how can I solve my problem by giving a transparent background to the text?


  // Customize the look of the table visual cells - (UITableViewCell *) TableView: (UITableView *) Table View CellForOutPath: (NSIndexPath *) Index Pathway {Fixed NSString * CellIdentifier = @ "Cell"; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == blue) {cell = [[[UTitleViews alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: cell identifier] autorelease]; } // Set the cell cell. Text lathele Text = [russfeed nodes object atxx: indexpath.ro]; // Try setting background color of text ??? Cell.textLabel.text.backgroundColor = [UIColor redColor]; // show the image in cell NSString * imageName = @ "rss.png"; Cell.imageView.image = [UIImage imageNamed: imageName]; Changing color in // NSInteger line = [index line]; If (line% 2) {cell.contentView.backgroundColor = [UIColor whiteColor]; } Else {cell.contentView.backgroundColor = [UIColor colorWithRed: 0.90f green: 0.95f blue: 1.0f alpha: 1.0f]; } Return cell; } 

Your answer found here (and very well described):

My short summary of the solution: UIFableViewCell subclass, and then use your subclass when creating an example in cellForRowAtIndexPath.

You then need to override only one method (set select) in your subclass UITableViewCell:

  • (zero) set selected: (BOOL) selected Animated: (BOOL) Animated {[Super Set Selected: Animated Selected: Animated]; Configure the view for the selected position for

    // (see in UIView * self.contentView.subviews) {view.backgroundColor = [UIColor clearColor]; }}

The reason that the built-in UITableViewCell class label will set the background white (or selected color) when the selection is displayed on the basis of the position in the table selected Method Choose your own option, call base class implementation, then set your subview background to clear to see your content. Look in the background.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -