發表文章

目前顯示的是有「UIImage」標籤的文章

單點讓UIView同時縮放與旋轉

UITouch *touch1 = [sortedTouches objectAtIndex:0]; //觸控移動的點         CGPoint beginPoint1 = *(CGPoint *)CFDictionaryGetValue(touchBeginPoints, touch1);         CGPoint currentPoint1 = [touch1 locationInView:self.superview];         double layerX = self.center.x;//指定UIView的中心點         double layerY = self.center.y;//指定UIView的中心點         double x1 = beginPoint1.x - layerX;         double y1 = beginPoint1.y - layerY;         double x2 = layerX - layerX;         double y2 = layerY - layerY;         double x3 = currentPoint1.x - layerX;         double y3 = currentPoint1.y - layerY;         double x4 = layerX - layerX;         double y4 = layerY - layerY;                  do...

將GLPaint的PaintView與底圖一起存成image

在xib檔中,有一個drawview,放在這個drawview下方再加上一個UIimageView,並把他的名字定為backgroundView。接下來把這個View設定IBOutlet到AppController上。 接下來我們可以設定一個save的funcation。 -(void)saveImage{//使用這個方法就可以把圖片全部合併起來,並寫入到Album裡面了。  UIImageWriteToSavedPhotosAlbum([self imageRepresentationForBackground], self, @selector(image:didFinishSavingWithError:contextInfo:), nil); } -(UIImage*) imageRepresentationForBackground {     UIImage* blendedImage=nil;     UIImageView* imageView = [[UIImageView alloc] initWithFrame:backgroundView.bounds];     imageView.image= backgroundView.image;     imageView.contentMode=backgroundView.contentMode;     UIImageView* subView   = [[UIImageView alloc] initWithImage:[drawingView imageRepresentation]];     [imageView addSubview:subView];     UIGraphicsBeginImageContext(imageView.frame.size);     [imageView.layer renderInContext:UIGraphic...