Save a view with images to edit later in iOS - ios

I have a view which has images, this images are added by the user, once the user decide the image to add, the user drag the image to a specific position in the screen, the number of images is completely dynamic.
What I want is to save in a file, an array or whatever you suggest the view with the images for lately the user could edit the images or positions.
I'm not asking for code I just want a hint for accomplish what I need. What do you think is the best way to archive this?
Thank you all!

If you want to exit the app use NSUserDefaults to save it and use later.
If you are not going to exit you can set a global NSMutableArray and add the UIImageViews for later use.

Related

Prevent manual screenshot in IOS Objective-C

On iOS, my requirement is disallow user to take manual screenshot from my application, either disallow or blur the captured screenshot. How?
The only solution is to simulate the iOS controls you have in your View using DRM'ed videos.
For each widget you need to create a video subclass that renders the widget, and apply DRM to the video.
You can try to do it yourself, or use a commercial solution such as the following:
https://screenshieldkit.com
It is possible but I don't recommend it because of the room for error. It was easier to do in the past, in iOS13 you will have to do it like this:
You will have to ask for the user's permission to read and edit their photo library, then you have a listener which is checking the number of photos in their library while they are using your app, if that number changes, they have just taken a screenshot (unless you allow other things in your app like tap and hold to save image, etc). When this happens, read said photo and apply a blur, then delete the photo from their library and save the blurred photos.
Warning: There are times where a user may get a photo while using your app that is not a screenshot (e.g. they received an airdrop) and you will now be tampering with their photos, which is very bad. To prevent this you may need to use key value pixel encoding on your screen at all times, for example the first 3 pixels of the screen are 3 very specific RGB values, that way if a new photo is detected and the first 3 pixels are those exact RGB values you know it's a screenshot of your app and not just another photo that was somehow saved while the user was using the app.
There isn't any regular solution to your problem!
You can do some tricks such as if you force the user to have their finger on the screen for the image to show then I don't think they can create screenshots. Because as soon as you press the home+lock keys to actually take the screenshot, the screen seems to behave as if there are no fingers touching it.
BUT what if the user takes a screenshot by AssistiveTouch?!
OR what do you want to do if user records screen and taking screenshot from the video?
I think it's better to change your strategy for example notify the owner of picture for taking screen shot by another one (like SnappChat)!

Swift swipe through photos randomly

Originally I had a different post, just wanted to redo it to clean it up.
This is more or less the layout I wanted to go with. Imagine the first imageview had dog pictures, the second one had cat pictures and the third one had rabbit pictures. three folders contain a group of three separate sets of pictures.
What is the best way to set it up so I can randomly swipe, lets say the first image view where it would only show pictures of dogs.
What I am asking is, is there a certain way to create the file structures or link the pictures to each image view?
I have the basics of the random (something with a 4 in it don't remember the method exactly) and the basics of swipe, just was looking for help with linking the photos and file structure.
Please let me know if this still doesn't make sense.
Thank you
EDIT
after messing with this this is where I am at:
with a very simple array basically
catsArray: [String] = ["catpic1","catpic2"......]
then I have it set up as
let randomIndex = Int(arc4random_uniform(UInt32(catArray.count)))
if (sender.direction == .Right)
{
self.catImageView.image = UIImage(named: catArray[randomIndex])
}
just me hacking things off the internet. now I am running into an issue. after a few swipes I get a null images or its just blank. Why is that?
now that I have some of this set up I am debating if I should just use parse for a server or if there is a better way.
thanks
Either approach will work. It's probably a good exercise to write both versions. You'd learn from it.
Your question is far too vague. Are you worried about memory? If so, you should not load the images into an array. Instead load the image names, and load each image as it is swiped on-screen. You might want to load the current image and the next image so it's already in memory and can be displayed without lag.
Are you talking about using a UIPageViewController? That's a good class for managing a set of pages that you can scroll through. There is a sample app from Apple called PhotoScroller that illustrates that technique, along with tiling the images so you can display large images and handle zooming and panning. (The app is written in Objective-C however.)
EDIT:
Your updates make your question a little clearer.
There are lots of ways to handle this. Here's 1.
Create 3 separate folders, one for cats, one for dogs, and one for rabbits. (in your app's documents directory, or in the bundle, if the images will be shipped with the app.)
Use NSFileManager to create 3 separate arrays of filenames. Take a look at the methods contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error: and contentsOfDirectoryAtPath:error:. You should be able to make either of those work.
Then you'll need to scramble your arrays of filenames to create a randomized order. You can use one of the block-based sort methods where your block uses a random number to determine the sort order of each pair of objects.
Finally you'll need to implement the swipe to switch.
It sounds like you are beginner so this is a lot to work through. You should break the problem into pieces and tackle them one at a time.

Wallpapers app iOS

I'm just trying to create a simple app, that would work as a wallpaper app. But i need to get the images off interwebs. So I thought I would get a rss feed of images and and basically have a rss reader that only has images. But I thought. . . I need a preview for the images in the main viewcontroller, so I would use just a image view for that, but it needs to be able to let the user be able to click on the preview image and take the user to another viewcontroller that will have the full size image. So should I try to put the preview images in a button? and let the button take the user to another viewcontroller with a full size imageview and somehow have the image display their. Sorry if this is confusing, this is the only way i thought how to do this. If their is an easier way, please tell me. And when it comes to, when the user wants to download the image online, i can just hook up some outlets for some buttons on the viewcontroller and link them together with the image, and put some code for saving the image. Would that work?
Ok, so let me get this straight:
You want to create an app that retrieves images from the internet, displays them to the user, and when the user clicks on an image, he/she is presented with a fullscreen view of that image?
There are a number of options you can pick from. Here are just a few suggestions:
You can use the image as the image for a UIButton
You can make the UIImageView call a function when it's tapped (using either a UIGestureRecognizer, or just implementing the touchesBegan: method).
You can put an invisible UIButton over the UIImageView
When displaying the image, you add an UIImageView to the UIViewController and hook it up using an IBOutlet (unless you're creating the layout in code). Then in the code, you would convert the downloaded image (NSData) into a UIImage, and then display this in the UIImageView.
It seems as you're a beginning iOS Developer, and I respect that you're trying to learn by doing. However, I suggest that you start off with reading some introductory tutorials before you begin your first project. Otherwise you might waste a lot of time. Here's a very good guide on how to get started! Good luck :)

Presenting choices to user in iOS app

I am writing an iPhone app. My next step is to create a card object. I know how to do this theoretically, but my problem is coming from my lack of experience in Xcode.
This is my add item page
I want the user to specify a name and then choose an icon, either from the 3 most popular choices, another page of premade options, or take their own picture and use that.
Now, how do I show those choices in a way that the user can select one and I can collect their response? Right now, they are simply buttons, I can add my background image to them, but I don't know how to record their response. I would like it to show them their selection by adding that shadow around the box.
I'm not sure if a button is the best approach.
Also, I will need the same selection behavior for the image they take themselves, but I figure if I get the icon choices to work, I can figure out using a picture taken by the user.
Thanks for any help.
I would create button "Select image" below the uiimageview.
This button would present action sheet where you would have two options
a) select form existing
b) take a picture.
Then I would probably use Grid view to present the existing icons and UIImagePicker for taking pictures :)

iOS image with hidden hyperlinks

I've just been handed these requirements but wanted to check whats the best way to proceed with this?
There is a large Image file which needs to be displayed on an iPad which should be zoomable/pannable (thats the easy bit).
Now this image has several 'items' which need to be clickable - i.e. I need to generate a UIPopoverview with additional information about the item every time the item is clicked.
Whats the best way to go on about this?
TIA!
Button nested in the imageView did the trick!
See previous post by #HermannKlecker

Resources