Comments (6)
Hey Lorenço, Thanks.
It works on UIView's (UIImageView's, etc) not controllers. It's simply adding a view (the "subview") onto another view. The Image and the Caption (text stripe) are two separate elements put together in the app. I understand that it gives the illusion that it is just one element (image+caption) but in reality it is not.
- If you want to store the image and the caption as one element then my suggestion would be to store them separately, and put them back together when you need to show them on your app.
- Otherwise you could take a snapshot (programmatically) of the elements you see on the screen, and get the image "with the caption on top". The main problem with this approach is that you'll lose a lot of the resolution. For example, on an iPhone 4-5s (with a physical width of 320px) you can map a 640px image onto 320px of space while retaining the resolution, but if you are to snapshot the same image then it'll be 320px and not the original 640px. I hope that makes sense. This may not be the best approach for what you may be trying to accomplish but if you want to go for it then this will help: http://stackoverflow.com/a/18994756
Best,
from diimageview.
Hi Daniel! Thanx for the reply mate.
In case one would save both separately and considering the app to be connected to a backend, the image and text should be both uploaded together in the same post but stored in different columns in the server right ?
For the users to see them together again, both the image and the text should be downloaded from the server and created together again in both views the UIImageView and the caption subview ? When seeing both together downloaded from the server the caption ability to be edited should be disable ?
I will try to do this using Parse.com
from diimageview.
You got it.
In the front-end you should grab the image, the text (the String), and the position of the UILabel (the caption). These 3 values would be sent to the back-end
In the back-end you would first rename the image, and place it somewhere in the server for later retrieval. Then you would upload the name of the image, as the referencing address, to the database along with the text and the position (how far off from the origin vertically) of the UILabel. This would all go in the same row in table of your database.
You can do this locally (in your computer), which I think is the easiest way to test, or Parse.com.
Just make sure your web server (i.e. Apache) is configured in a way so that you have all necessary permissions to move and write files on the server.
This is the general idea. Hope it works for you!
Best,
from diimageview.
Okay Daniel thnx! I will try that in Parse.
If you think to implement that locally to your sample please give me shout.
Cheers!
Em 17/11/2014, à(s) 20:51, Daniel Inoa [email protected] escreveu:
You got it.
In the front-end you should grab the image, the text (the String), and the position of the UILabel (the caption). These 3 values would be sent to the back-end
In the back-end you would first rename the image, and place it somewhere in the server for later retrieval. Then you would upload the name of the image, as the referencing address, to the database along with the text and the position (how far off from the origin vertically) of the UILabel. This would all go in the same row in table of your database.
You can do this in your locally (in your computer), which I think is the easiest way to test, or Parse.com.
Just make sure your web server (i.e. Apache) is configured in a way so that you have all necessary permissions to move and write files on the server.This is the general idea. Hope it works for you!
Best,
—
Reply to this email directly or view it on GitHub #2 (comment).
from diimageview.
You could create a snapshat:
-
(UIImage *)snapshot:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();return image;
}
Then change the scale factor to whatever you like, maybe to 2:
void UIGraphicsBeginImageContextWithOptions ( CGSize size, BOOL opaque, CGFloat scale );
This should take care of losing any resolution. Daniel can correct me if i am wrong about not losing resolution.
from diimageview.
You are correct.
from diimageview.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diimageview.