Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:11:16+00:00 2026-06-17T22:11:16+00:00

I m writing an APP so the user can draw over an UIImageView He

  • 0

I m writing an APP so the user can draw over an UIImageView

He can also pinch on it for zooming in/out.

I have implemented an UNDO feature.

So every time the user draw a stroke or pinch the picture, i save the UIImage and the frame :

    ImageWithFrame *imageWithFrame = [[ImageWithFrame alloc]
    initWithImageAndFrame:imageViewSubject.image andFrame:imageViewSubject.frame];
    [self.tabImageForUndo addObject:imageWithFrame];

I tried to save the whole UIImageView in my array but it doesn’t work, that is why i save the UIImage and the frame.

And after the user click on the UNDO button, i got the last imageWithFrame from the array

    ImageWithFrame *imageWithFrame = [self.tabImageForUndo lastObject];

And i do this :

    ImageWithFrame *imageWithFrame = [self.tabImageForUndo lastObject];

    self.imageViewSubject.frame = CGRectIntegral(imageWithFrame.frame);
    self.imageViewSubject.image = imageWithFrame.image;

    self.imageViewSubject.autoresizingMask = UIViewAutoresizingFlexibleWidth |     UIViewAutoresizingFlexibleHeight;

    [self.tabImageForUndo removeLastObject];

And i clear the graphic context just in case :

    UIGraphicsBeginImageContext(self.view.bounds.size);

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextClearRect(context, self.view.bounds);

   // clean up context
   UIGraphicsEndImageContext();

======================================

My UIImageView appears, i do a stroke, i make an undo, it works.

And after I do a pinch, the UIImageView is resized (zoom out or zoom in) , i do an undo, so the UIImageView get back to its old frame.

BUT

If i draw another stroke, the picture get blurred and the UIImageView become smaller and smaller.

Look at this video http://tinypic.com/player.php?v=ivbkn5&s=5

I got the same effect (but on the whole UIImage, it is normal as the UIImage has been been redraw with the stroke)

It has been uploaded by another user, from this post : CGContextStrokePath not working when zooming and drawing images

But i don’t think the source of its problem is related to mine.

PLEASE NOTE THAT If i don’t do the pinch, it works perfectly, so i think the problem is when i set the old frame after a pinch gesture.

I hope i m clear enough.

Thanks a lot in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:11:17+00:00Added an answer on June 17, 2026 at 10:11 pm

    I finally solved it by using

    UIGraphicsBeginImageContextWithOptions(self.imageViewSubject.bounds.size, self.imageViewSubject.opaque, 0.0);
    

    instead of

    UIGraphicsBeginImageContext(self.imageViewSubject.bounds.size);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an app where a user can upload an image, draw on it
I'm writing a mathematical app where the user can draw several mathematical figures like
So the app we are writing has certain privileges a user can have, and
I'm writing an app where a user can both create their own pages for
I writing an app in python for google app engine where each user can
I'm writing an app that monitors the user's location. I have a CLLocationManager object
I'm writing an application where a user can fill out a form on an
I'm writing app where user can take bunch of pictures (up to 20) and
I have a textfield in my app, whre the user can enter any number
I am writing an web app, in which a user can create group and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.