Search code examples
iosuiimagedrawingdrawredraw

how to specify image dimension/size when doing a drawAtPoint?


I have some images and I want to draw them using drawAtPoint ( I am using a table of 100s of cells and doing the draw as recommended for making the scrolling faster). Now, these images are kind of random (their size can be anything.. ) and I need to specify the dimension I want to fit in.

Can anyone kindly tell me what to do ?

Thanks.


Solution

  • Assuming I understand what you want to do use:

    - (void)drawInRect:(CGRect)rect;
    

    See http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html

    When using drawAtPoint you cannot specify the dimensions, it will draw the entire image in the current graphics context.