-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial content #2
Comments
Thank you for the positive feedback. I'm not sure what exactly are you trying to do, but if I've understand it right here is my suggestion You can put the drawing view on the top of an imageview that loads the saved image. Drawing view is transparent, so it could do the trick Let me know if that will solve your problem |
Thanks for that idea. I was looking at doing that in another section of code. The "other" section of code where I want to integrate your code would allow me to draw on an existing PDF. BUT... that's not exactly what I'm looking to do here. Here is what I'm doing. I have extended your code to write out to file (the "Documents" directory). I simply replaced your code that takes a snapshot and saved it to file instead. This works fine. The problem is when I want to load that file again. I have placed a new method in your class that allows me to set private "imageview" property. This works fine as well. The problem is that as soon as I add touch the screen (with any tool) to edit the previously saved imageview, it messes up. Let's say I had drawn a square that aligned itself with the edges of my iPad. And then I saved that picture (as stated above). When I reload that picture the square is there just like I left it. It looks great. But... I add a scribble in the middle of the square and then it goes all wrong. The scribble stays where I put it, but the original square is zoomed out. All I see of the original square is the top lefthand corner of the square. It seems like it's using point 0,0 as an origin for its expansion. If I save this image and then reload it, the same thing happens as soon as I draw on the screen. It zooms out and moves down and to the right. I guess I could overlay and then blend the two layers when saving, but seems like overkill for editing an image. Maybe not though. I'll concede to your opinion on this. Any help/guidance you could give me would be greatly appreciated. |
This is interesting. Is it possible to have the code that you are using so I can reproduce the issue ? Sorry for the delay, super busy at work |
Absolutely. Can me give me an email address and I'll zip up the module. I really appreciate it, especially when you're busy. Once we get it figured out, I'd be more than willing to add my changes to you library if you want (you may not want them). But having a way to initialize the drawing is critical for many uses. If not email, how would you like me to send the code? |
Email is fine. You can use acerbetti@gmail.com I'm happy to integrate your improvements to my library. You can fork the project and send me a pull request |
@acerbetti - So is there a way to not clear the drawingView on load? I have included the drawingView with files into an app I'm working on, but I would like the drawing to persist even if the user exits the ViewController. Is there a way to not clear the drawingView on load/appear? |
@ToddManUtah - did you ever figure out a solution? I am trying to accomplish the same thing (load a previous drawing from device files) but the image appears zoomed and offset to the right. |
Sorry Adam for the delay. I've been super busy with other projects and I'm not currently working on the component anymore. I know loading an image from disk and import in the view can be tricky. What about saving each step in a text/XML/Json format that can be exported and reimported later ? It will also allow you to edit or undo the draw |
@ToddManUtah - In case you're still wondering how to correct the "zoom" issue, I figured it out. What is happening, is that instead of scaling the image to 2.0 on your retina device, it automatically assumes the scale should be 1.0, which means it shows the full @2x saved image, appearing huge [zoomed]. FIX:
I don't think I left out any details, but if I'm missing something, feel free to comment back. Hope this helps! :) |
@acerbetti - can you see my issue here: #1 (comment) |
Can you check the issues I posted on the GitHub project? I figured Thanks so much! Adam Dehaven On Sat, Dec 7, 2013 at 5:13 PM, Adam Dehaven abdehaven@gmail.com wrote:
|
Hi Adam, I'm trying to understand your request. The code snipped that you provided above is for the ViewController... do you mean my demo ViewController ? so, do you only want to remove readonly from the property "image" ? |
@acerbetti - The code above goes in my ViewController that displays the drawingView. I could, however, place it in the Basically, my question is this:
How can I load my image data from I tried your method for blending (here:#1 (comment)) but the same problem (# 3 above in my list) still occurs. If that doesn't make sense, I can create a project you can run to see the behavior. |
I did a commit to add support to load an external image, let me know if that will work for you |
@acerbetti - I tested your It loads the image properly on initial load, however, if I then draw on that image, and then press "Undo" once, it still clears both the last drawn line, as well as the initial image. What is causing it to clear when pressing "Undo"? |
I had this same issue. Inititialized the view with a default image (landscape diagram). Perform actions, hit undo, and it clears the last step AND the loaded image. Here was my fix: Add a variable for prev_image to your property declarations:
Under the loadImage method, copy the loaded image to this new property:
Inside the updateCacheImage method add the drawInRect call right after you clear the initial image in the redraw condition:
This will keep whatever image you initially load. |
@iaretyler - that works perfectly! Thanks! The only thing I added was in my Here's my clearSketch: - (void)clearSketch
{
[self.drawingView clear];
[self.drawingView loadImageData:nil]; // **ADDED** clear prev_image
[self updateButtonStatus];
} |
Good catch. We don't allow our guys to clear the diagram if its been save from the drawing view, jus delete the old one elsewhere in the code. |
I encountered this problem,I changed line 121(in the ACEDrawingView) to [self.image drawInRect:self.bounds]. it's ok.... |
Hi acerbett, |
i resolved these....i want to zoom these editing image.help me |
@Shivaseachange please open a new issue for that |
@acerbetti I'm using this code, which is very use full as per my requirement, only facing one challenge there. When i draw or write something on view then it escape few starting character, for example if i write Hello then half H will cut off. Do you have any suggestion for this issue ? |
I am trying to use you code to expand a simple app I'm working on. This code is really helpful!!!!
Questions: I'm saving the image to file and then reloading it. The problem I'm running into is setting the ACEDrawingView image with default content. It assumes an empty drawing surface. Is there something I'm missing? Did you allow for initial content?
I changed the code to allow (removed read-only setting on image in ACEDrawingView). I then set it in viewDidLoad of the controller class. This sort-of works. The image loads from file just fine. The problem is as soon as I draw on the image, it zooms out and moves the image down-and-to-the-right. This isn't ideal (obviously). Any ideas on how to make this more flexible (and still work)?
The text was updated successfully, but these errors were encountered: