provideal/MMGridView

Assign image in cell's backGround

Closed this issue · 9 comments

Hi René,

I'm a bit confused, I still couldn't find out how to set the cell's background with an image.

I'm using this code in the cellAtIndex delegate method :
cell.backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.jpg"]];

The weird part is that if I use [UIColor redColor] for example, it'll work perfectly. Any Idea of what I'm might be doing wrong?

Thanks!

Hi, this is weird. Please create a gist with your cellAtIndex method, so I can look at it.

Regards,

René

Here is the gist url. I tried the same code line in one of my other projects and it works...
-> myTableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"testImage.png"]];

It's insane!
git://gist.github.com/964222.git

Don't bother, I figured it out...
I guess it was a problem with your demoApp and Xcode or something...

Thanks anyways!

what was the problem in the end? i'm getting a lot of memory issues with the demo project

Well, I couldn't find out what was the problem exactly. I just created a new project, included the MMGrid class files and rewrote the exact same code... It worked.
There must be some mystic issue in the demo project hahaha.

how strange, thanks anyway

I do not see any memory leaking issue, but the reloadData method is actually called too many times during initialization. This, plus the fact that a cell is currently not reused (like UITablewView reuses rows) may have an impact on speed and memory usage, especially when creating complex cells. I will address this in the next release (contributions are welcome).

Regards, René

I got the same issue with the demo project, creating a new project fixed the issue.

Hi Alexandre,

you mean you have issues when modifying the demo project to use an image as a cell background, right? This is strange. I wasn't able to reproduce that. I'll have a second look. Thanks for the report.

René