2011-07-24 3 views
0

私は、UIImageViewでUImageをハードコーディングしているところに、次のコードを書いています。しかし、私はUIImageView上のどこにUIImageを配置する必要があるかをアプリケーションが選択できるように変更するように依頼されています。私はユーザーが画面上をクリックし、アプリケーションがUIImageを配置する場所のx、y座標を格納していると思っています。私はちょうどそれをやり遂げる方法を知らない。UIImageViewにUIImageを配置できるようにコードを変更するにはどうすればよいですか?

CGPDFDocumentRef document = CGPDFDocumentCreateWithURL((CFURLRef)pdfUrl); 

      //lets now convert the fax to an image 
      CGPDFPageRef page = CGPDFDocumentGetPage(document, 1); 
      UIImage *pageImage = [PDFPageConverter convertPDFPageToImage:page withResolution:144]; 

     UIImage *shieldLogo = [UIImage imageNamed:@"shield_bw.gif"]; 
     UIGraphicsBeginImageContext(pageImage.size); 
     [pageImage drawInRect:CGRectMake(0, 0, pageImage.size.width, pageImage.size.height)]; 
     [shieldLogo drawInRect:CGRectMake(150, 100, shieldLogo.size.width, shieldLogo.size.height)]; 
     [theSignature drawAtPoint:CGPointMake(200, 100) withFont:[UIFont fontWithName:@"Arial" size:15.0]]; 
     [theSignature2 drawAtPoint:CGPointMake(200, 120) withFont:[UIFont fontWithName:@"Arial" size:15.0]]; 
     UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext(); 
     UIGraphicsEndImageContext(); 
     [image setImage:resultingImage]; 

答えて

1

サブクラスは、あなたがそれに応じて画像ビューのframeプロパティを変更しますする-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;を使用してイベントを、触れないように対応してください。

関連する問題