jithinroy
jithinroy

Reputation: 1885

UIImage or CGImage is preferred?

I have a UIView with UIImageView as its subview and i need to change the image in that view while the user swipe it.

I tried it using UIImage, but the app crashes and the memory keeps on rising.

When I tried some googling I got to know that CGImage might be a good choice. Can someone direct me to the right track.

Thanks

Upvotes: 0

Views: 2156

Answers (2)

spd
spd

Reputation: 2134

Try loading UIImage to UIImageView by tiling

Upvotes: 1

Michal
Michal

Reputation: 4875

UIImageView works with UIImages. CGImage is a representation of more low-level image data.

You want to keep using UIImage and concentrate on fixing your bugs. Apparently you are not properly handling memory - retaining and releasing images. Use debugger to fix the crash, Instruments to figure out why memory consumption goes up. I answered another question with information how it can be solved: UITextView delegates problem

Upvotes: 2

Related Questions