iphone - Why does this UIImage disappear from UITableViewCell when rotating to landscape? -


I am trying to set up a UITableViewCell which has an image in the upper right corner.

I'm working for portrait mode, but when I rotate in the scenario, the image disappears.

Here is the code:

  - (UITableViewCell *) Table view: (UITableView *) Table view CellForOutPath: (NSIC XPath *) IndexPath {Fixed NSString * Cell Identifier = "Sale ";; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == null) {cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease]; Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; UIImage * Coke image = [UIImage imageNamed: @ "star_corner.png"]; UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (cell.contentView.bounds.size.width - corner image.Width, 0, corner image. Size.width, corner image.ize.height)]; ImageView.tag = kCornerImageViewTag; [Cell.contentView addSubview: imageView]; [See image release]; } UIImageView * theView = (UIImageView *) [cell.contentView view: kCornerImageViewTag]; [TheView Set Image: [UIImage imageNamed: @ "star_corner.png"]]; Cell.textLabel.text = @ "Text Label"; Return cell; }  

Interestingly, if I comment on the "cell.textLabel.text =" line, then the image appears in the scenario ... though it is not yet correct.

If anything, then I am doing wrong, please tell me.

Thanks in advance for any assistance.

I got it The solution was to create one for two image UIImageView ... for star corner image, and cell background image.

I added the star corner UIImageView as a subview on the background image UIImageView, then it was assigned to the cell. See background.

The star displays itself correctly by using UIImageView status:

  starimageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;  

And since the whole thing to the cell Background Watch (instead of cell content view) is assigned, this is not affected by the delete button or rearranged controls of the cell.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -