create one UIImage from two UIImageView.

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

  1. Monaj macrumors regular

    Joined:
    May 24, 2009
    #1
    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.
    thanks
    Monaj
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    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