Save edited image to the iPhone gallery - objective-c

am working on an app where i am loading one image from the bundle and with the help of quartz i am adding two red circles on that image, the image is loaded in the instance of the UIImageVIew class.
I want to save the image with the red circle, so far i have found only one method and thats
UIImageWriteToSavedPhotosAlbum(UIImage * image,id completionTarget,SEL completionSelector, void * contextInfo)
but its not working as it is saving the image from the bundle only, in some post i have read that it can be done using CALayer but i found no useful link to do that, i would be glad if you can post me the answer or any tutorial link to do that.

Here's a trick! Refer to Capture UIView here, you can capture the UIImageView snapshot and save it using UIImageWriteToSavedPhotosAlbum.

Related

Adding a UIImage from a UIGraphics Context to a Tweet

I have a game that I've been working on for iOS. We let our users tweet the results of their games and I thought it'd be fun to add a badge or something to the tweet to show details.
I create an image using UIKit. Then, I attach that image in iOS 6.0 with -[SLComposeViewController addImage:] or in iOS 5.* with [TWTweetComposeViewController addImage:] but neither of them will attach an the image.
If I use Facebook or Weibo, the image attaches fine. With Twitter, no luck at all.
Has anybody had any luck attaching an image to a tweet?
If you're receiving NO for the return value of TWTweetComposeViewController, the documentation says: YES if successful. NO if image does not fit in the currently available character space or the view was presented to the user.

iOS: how to add "cartoon" style animation (movie) to the slide?

I'm wondering if it's possible to have a slide with text AND add some animation into it for an iPad app. See screenshot below to get an idea of what I need. I want that guy jump up and down and smile. I'm sure I'm not capable of drawing that image using Objective-C primitives myself, so I'm looking at the following options:
Do complete animation in 3rd-party tool (Adobe?) and then add it as single standalone file on the slide. But I do not know, what formats are supported in iOS, what are standard formats, and, at the end, how to insert that file on the slide. Can somebody clarify this please?
Do complete animation, and then save frames as images, and then quickly change images to give illusion of a movie.
Am I missing something? Are there any other ways? what's the best option?
Please let me know if I'm not clear enough - I will try to provide more information.
Thank you.
If you want to use a movie file for the animation, you can find the supported video formats in the iOS Technology Overview, under “Media Layer > Video Technologies”. You will need to use an AVPlayerLayer from the AVFoundation Framework to show the video.
If you want to use a separate image file for each frame, you can use one of the +[UIImage animatedImage...] methods to create an animated UIImage, and display it in a UIImageView.
If you want to use a single animated GIF for the animation, you can use this public domain UIImage+animatedGIF category to load the GIF into an animated UIImage, and display it in a UIImageView.

AVFoundation capture UIImage

I'm trying to capture one or more UIImages programmatically using AVFoundation.
I set up the sessions and input devices and everything, but when I try to find explanations on how to actually take the photos, all I get is buffeled information about connections and what not.
I couldn't find a single example of actually taking photos and saving it to UIImage for further processing. All the example use a constant kCGImagePropertyExifDictionary Which doesn't seems to exist in iOS 5 SDK..
Can someone please provide me with a code or an explanation from top to bottom on how to take and save an image from the front facing camera to a UIImage using AVFoundation?
Thanks alot!
To use kCGImagePropertyExifDictionary, you should #import <ImageIO/ImageIO.h>.
All of the other information you seek is inside the AVFoundation Programming guide - particularly the Media Capture section.

iOS UIImageView smooth Image presentation

One of the ways to improve user experience in iOS while showing images is to download them asynchronously without blocking the main thread and showing them....
But I want to add something to this -
Initially when there is no image,show a spinner while the async download has started.
After the download cache the image on local iOS disk for later use.
After the download populate the image part of UIImageView.
And dont just plonk the image into view for user. Showly Fade in the user (i.e. from alpha 0.0 to 1.0)
I have been using SDWebImage for sometime now. It works well but does not satisfy my 1st requirement (about spinner) and 4th.
Is there any help out there to satisfy all this?
Three20 http://www.three20.info has a TTImageView class that statisfies 2-3, you can subclass it and overwrite setImage: and create the fade animation there. (or just modify TTImageView.m directly).
Spinner is easy as well when you modify TTImageView you can add a TTActivityView on top and remove it on setImage:

Objective C, Download a photo from web and show as a full screen

Let's say I have a thumbnail image and I have an original image(about 1200 * 1600) on my server. What is the best way for users to see the full screen of the original image on iPhone?
I could send HTTP request to download the image but how can I show the image on the full screen? Also. If I download the full size image then is this bed for memory management?
Use a UIImageView in your UI, download the fullscreen image to disk, create a new image using UIImage's imageWithContentsOfFile:
+ (UIImage *)imageWithContentsOfFile:(NSString *)path
and eventually assign the image property of your UIImageView instance to this newly created image.
To download the fullscreen image, do not use synchronous methods like NSData's dataWithContentsOfURL or it will block your UI. Instead use the asynchronous methods of NSURLConnection.
See the Loading Data Asynchronously section of NSURLConnection Class Reference.
The full image seem to be appr. 12 times larger than the standard iPhone 320x480 screen. I think you can pre-render a down-scaled image to download for this and not feel about that.
Automator is a simple way to batch process this for you. See this vid.
http://www.youtube.com/watch?v=q7p081Ui9WY