Monday, 15 March 2010

uiimageview - IOS UIImage Scale and Crop, scaling up actually making image smaller? -


Using someone else's pinch gesture code im scaling the right thing, but in my photo editing app for it and user once reflect my image scaling which presses scaling, I changes and saved or removed from the need to say that I should be closer to the image and if someone on scale scale the pinch Whether Apply I could use frame size * uigraphicsbeginimagecontext I amount they stretched out but that strategy does not work because the user measures the image and the button image is saved little hit because it is very large view now Squeezing when I really want it to crop any left crop and do not do any fitting.

  - (IBAction) pinchGest: (UIPinchGestureRecognizer *) The {if (sender.state == UIGestureRecognizerStateEnded || sender.state == UIGestureRecognizerStateChanged) {NSLog (@ "sender.scale =% f ", Sender scale.); CGFloat currentScale = self.activeImageView.frame.size.width / self.activeImageView.bounds.size.width; CGFloat newScale = currentScale * sender scale; If (new skeleton & lt; .5) {newScale = .5; } If (Newcastle> 4) {newScale = 4; } CGFFEINE Transformer Conversion = CGF TransfectMaxacel (Newcastle, Newcastle); Self.activeImageView.transform = change; ScalersOfficialChange = newScale; Sender scale = 1; }} - (IBAction) doneMoverViewButtonPressed: (UIButton *) Sender {// Close the ability to turn off & amp; Scale Mowers Weaveactive = No; NSLog (@ "% f% f", drag physical change.x, dragographic change.i); NSLog (@ "% f", rotationOfficialChange); NSLog (@ "% f", scalersOfficialChange); Below // problem area ... CGSize newSize = CGSizeMake (self .activeImageView.bounds.size.width * scalersOfficialChange, self .activeImageView.bounds.size.height * scalersOfficialChange); UIGraphicsBeginImageContext (newSize); [Self.aktivimagaviavkimej Dravinrekt: Kgrektmke (Dragofarfaisialchangekksh, Dragofarfaisialchangeky, Selfklyercontanerviavkbondsksaijkvidth, Selfklyercontanerviavkbondsksaijkhait)]; Self. Active Image I UIGraphicsEndImageContext (); [Self-hideaway animation]; // Reset activimageview coords CRGRA myFrame = self.layerContainerView.bounds; MyFrame.origin.x = 0; MyFrame.origin.y = 0; Self.activeImageView.frame = myFrame; // Change change value in ResetOfficchange.x = 0; Drag OfficialChange.y = 0; Rotation formal change = 0; ScalersOfficialChange = 0; }  "itemprop =" text "> 

First of all, can you clarify your question further?

I suggest that you want to draw your image in a reset and do not want to squeeze it, am I right?

Then try this method:

  // method: drawInRect: (CGNT) will scale your image and squeeze it to fit in the rack area / So if you do not want to scale your photo, then you can use the method given below [Image DrawApartinInteractive ¼ ?? (CGMact) correct); // This method will not scale your image and will not cut the unnecessary part    

No comments:

Post a Comment