0
votes

At this moment i am working on iPhone 5.0 simulator.In my tableview i have taken a uiview for each cell background color and this view has a background image.

Now, My problem is when my table containing controller load then in the- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

i have wrote this for table cell background.

cellView = [[[UIView alloc] initWithFrame:CGRectMake(0,8,250, 51)] autorelease];
cellView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"order_text_area.png"]];
cellView.tag =10;
[cellView.layer setOpaque:NO];
cellView.opaque = NO;
[cell.contentView addSubview:cellView];

For keeping cell background transparent i have used this code and it works,But

[cellView.layer setOpaque:NO];
cellView.opaque = NO;

when i select a cell then it goes it's corresponding controller.Now my problem is when i return back to my tableview controller then cell background do not keep in transparent view means cell view do not work on those code.So anybody help me. I am in serious problem.

NOTE THAT *I wanted to give a screen shot but unexpectedly in simulator i do not face this problem.*

Thanks In Advance.

2
hey have you solved this problem? I'm having something like you are saying and i don't know how to solve this :/ I'm struggling for days now.. - Lukas

2 Answers

0
votes

If you are making a change to the cell background directly in your code, what is probably happening on the device is that when you move to the next screen, the tableView on the previous screen is being unloaded to save memory, and when you go back to it, it is re-loaded and the cells are created again by calling your tableView:cellForRowAtIndexPath: for each cell.

This would also explain why it doesn't happen in the simulator, which is less memeory-constrained and so probably isn't unloading the view. Try simulating a memory warning in the simulator on the second page and then going back to the first view and see if your cell is de-highlighted like it is on the device.

To make the effect persist after the view is reloaded, you will need to remember the cell index that was highlighted before pushing the new view, and then re-highlight the correct cell in your tableView:cellForRowAtIndexPath: method when it is re-created.

0
votes

do you have

[self.tableView reloadData]

in will appear?

if you already have, try to put a tag at the table view, in the will appear, remove the tag from super view and recreate the table.

hope i understand the question.