I have noob objective-c question. How do you add an UIImage to a MSMutableArray? Here is the code that I have:
MSMutableArray *arr = [[NSMutableArray alloc] init];
UIImage *image;
UIGraphicsBeginImageContext(contextSize);
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0, pushUpSize);
[screenWindow.layer renderInContext: context];
image = UIGraphicsGetImageFromCurrentImageContext();
}
UIGraphicsEndImageContext();
[arr addObject:image];
But this crashes the program when it tries to add the image. I read somewhere that its adding a variable but not the pointer, is that correct? How do I add the UIImage to the array, its an object isn’t it?
Thanks!
@thiesdiggity: Not much is wrong in your code from what I can see. But just try out the below code as I think the
imageobject isnil:Let me know if you need more help and please post your crash log for more help
Hope this helps.