create one UIImage from two UIImageView.

Discussion in 'iOS Programming' started by Monaj, Jan 5, 2010.

  1. Monaj macrumors regular

    May 24, 2009
    Hi All

    I have two UIImageView on the UIView. Each UIImageView have one UIImage. Now i want create an one UIImage from two UIImageView.

    I did get way to do.
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    Get the two underlying UIImages. Create a new UIImage the size that you want the resulting image to be. Lock focus on that new image. Draw the first image. Draw the second image. Unlock focus.

    And no, I'm not going to provide code: that should be more than enough to work it out using the documentation.

    Edit: OK that's too desktop Cocoa based to work: you can't lock focus on a UIImage. Try UIGraphicsBeginImageContext(), UIGraphicsGetImageFromCurrentImageContext() and UIGraphicsEndImageContext() instead.

Share This Page