How to get Photo Booth Flash Effect like on MacBook Pro - iphone

I have a white flash that appears to alert the user that a picture was taken but the white flash doesn't add light to my photos. My photos are still dark no matter what I have done. I have changed the duration of the flash and moved
[[self captureManager] captureStillImage];
to take pictures after the flash and still no luck. I have looked at the photo booth app on my Macbook and it seems that the flash comes just a little bit before the image is captured and it provides light to the photos in the dark. I want to replicate this. Can anyone help me?
- (IBAction)captureStillImage2:(id)sender
{
// Capture a still image
[[self stillButton] setEnabled:NO];
// Flash the screen white and fade it out to give UI feedback that a still image was taken
UIView *flashView = [[UIView alloc] initWithFrame:[[self videoPreviewView] frame]];
[flashView setBackgroundColor:[UIColor whiteColor]];
[[[self view] window] addSubview:flashView];
[UIView animateWithDuration:1.0f
animations:^{
[[self captureManager] captureStillImage];
[flashView setAlpha:0.f];
}
completion:^(BOOL finished){
[flashView removeFromSuperview];
[flashView release];
}
];
}

Try increasing the brightness using something like [[UIScreen mainScreen] setBrightness:1.0]; for iOS5+ .
Keep in mind though, that the effect on a small display like an iphone won't be able to match the effect of a full sized macbook pro (it's all about brightness and backlit area).

Related

iOS: is it possible to attechment of MFMailComposeViewController with Animation?

I am working on attach images into MFMailComposeViewController everything is fine working but i want to know that is it Possible to give animation of Attachment?
For Ex:- When we attach images from Photo Gallery in iPhone Device. and while select mail Button that all selected Images Move's in MailComposeViewcontroller with Nice ANIMATION.
So please can any-buddy guide me this stuff is possible or not.? and if YES then how can i set Animation of Attachment.
There exists some semi-solution. You can in fact add any UIView as subview of you main app's window. It will than sit on top of all apps content. Using this you can simulate animation of attaching image to MailComposeViewcontroller
See my example code. This code slides image view from top of the screen to mail composer so it imitates adding of image as attachment. Everything is commented.
// Get apps main window
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
// Setup frames of animated image view in apps window - adjust to your needs
CGRect finalImageFrame = CGRectMake(30, 220, window.frame.size.width-60, 100);
CGRect initialImageFrame = finalImageFrame;
initialImageFrame.origin.y = -initialImageFrame.size.height;
// Create image view to be animated as attachment
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"myImage"]];
imageView.frame = initialImageFrame;
imageView.backgroundColor = [UIColor redColor];
// Add animated image view to window
[window addSubview:imageView];
// Animate image view with slide in from top
[UIView animateWithDuration:0.4
animations:^{
imageView.frame = finalImageFrame;
}];
// Present mail composer
[self presentViewController:mailComposer animated:YES completion:^{
// Once the controller appears, hide the image view - adjust this animation according to you needs
[UIView animateWithDuration:0.4
animations:^{
imageView.alpha = 0;
} completion:^(BOOL finished) {
[imageView removeFromSuperview];
}];
}];
Of course the code may need some adjustments and polishing, but it shows the concept. You can play with animations to make some better effect. There is a lot of animation tweaks I would add, but I wanted to keep the example code as short at it can be ;-)
That is iOS custom animation effects and is not exposed as iOS API's so no you cannot get this effect out of box. The reason I know that this effect is not exposed to developers is from Apple iOS 6 Docs. There is only one method which deals with animate and its the standard one.
What you can try is this. After the user has selected image(s) from his photo gallery (i.e. from ALAssetsLibrary) you can animate a "image" that looks like a MFMailComposeViewController. The animation would similar to what iOS provides i.e. background fading, MFMailComposeViewController appearing and the images sitting in the "body" section of the mail. Once the animation finishes, remove the "image" of MFMailComposeViewController and show the actual call MFMailComposeViewController invoked with animaiton:FALSE option. Hope I was clear. Essentially what you are providing is an illusion of MFMailComposeViewController and once animation is done, taking away the illusion and showing the reality.
Theoretically this could work but exact animation timing and user perceived feel has to be tested out.

self.view.bounds.size.height different values for iPhone and iPad

Okay, aside from the obvious dimensions differences, I think I may have a logic error in my code that causing this inconsistency.
I'm using self.view.bounds.size.height to determine the bottom edge of the screen and here's where the inconsistency lies.
For reference, loadingView is always a consistent size.
if (loading==TRUE) {
[UIView animateWithDuration:0.25 animations:^{
[loadingView setFrame:CGRectMake(loadingView.frame.origin.x, self.view.bounds.size.height-loadingView.frame.size.height, loadingView.frame.size.width, loadingView.frame.size.height)];
}];
} else {
[UIView animateWithDuration:0.25 animations:^{
[loadingView setFrame:CGRectMake(loadingView.frame.origin.x, self.view.bounds.size.height+loadingView.frame.size.height, loadingView.frame.size.width, loadingView.frame.size.height)];
}];
}
I run the above function to show and hide a 'page loading' notification at the very bottom of my screen.
Heres' my issue:
iPad (correct):
iPhone (incorrect):
Now, obviously there's a height difference here and I'm not sure why it's occurring only in iPhone but not in iPad.
I'm trying to make my app Universal, and obviously, I don't want lots of device checks throughout my code. There must be a more elegant way to determine the bottom edge of the device.
Please make sure that self.view is fitting the whole screen. (Double check your auto-resizing masks, etc. in IB.)

Using iPhone 5 full screen for non retina game

I would like to update my non retina game to use the wide screen in the iPhone 5, is it possible to use a 568x320 sized OpenGL window?
Yes. But your graphics will not show as sharp as it could be.
I suggest you to make #2x version of all your graphics.
I have now compiled and got my game working at 568x320, all I had to do is include the Default-568h#2x file and do this in createFrameBuffer
[self setFrame:rect];
[self setBounds:rect];
[self.layer setFrame:rect];
[self.layer setBounds:rect];

Photos App Animation Advice

I have scoured the net for this question and have came up empty handed. I have an app that I'm making which I want the user to be able to view an image i have hooked up to the UIImageView to show fullscreen. Basically by tapping the UIImageView it would make the buttons and status bar disappear until image is tapped again. I know this is probably a simple animations block that i would throw in my viewdidload or where I call my image from. I'm just unsure where it goes.
here is where my image comes from if the helps.this is in my .m file
-(void)viewDidLoad {////Loads UIImageView from URL
todaysWallpaper.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:#"http://www.inkdryercreative.com/daily/archive/mondays/images/062-mondays-960x640-A.jpg"]]];
I have four buttons that appear on screen. i want it to resemble the feel you get in the native photos app when you look and a picture and everything else on screen dissolves. Any help or guidance would be great. I can send additional code if needed
CGRect *oldFrame = todaysWallpaper.frame; // store this somewhere for when you go back
CGRect *newFrame = [[UIScreen mainScreen] bounds];
[UIView animateWithDuration:0.5 animations:^{
todaysWallPaper.frame = newFrame;
}];

How do they make those fancy Splash screens?

Although I currently only have one app out in the App store, I have several in the works and was wondering how users are making their splash screens.
I have seen several very cool animated ones and was wondering if this was all done via code or is it just something you would make in possibly iMovie and just run it as a video.
Any idea how some of these are being created? Examples are anything from Time Warner Cables app to Bejeweled.
Thanks in advance for the info.
Geo...
See iPhone Animated Loading Screen <-- the answer in there seems to be that the "fancy" splash screens aren't actually loading screens.
So what you will have to do is to create an animation (maybe a movie clip, or an imageview animation or similar) that can be run when the app starts artifically, possibly with you loading your resources behind that, rather than using the default splash screen functionality (to speed up the start of your app).
Hope that helps
Try this in App delegate class ....
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIImage *splashImage = [UIImage imageNamed:#"Picture 2.png"];
splashImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 20, 320, 480)];
splashImageView.contentMode = UIViewContentModeScaleAspectFit;
splashImageView.image = splashImage;
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:#selector(removeSplashScreen) userInfo:nil repeats:NO];
[window addSubview:splashImageView];
}
-(void)removeSplashScreen{
[UIView beginAnimations: nil context:nil];
[UIView setAnimationDuration:2.0];
splashImageView.alpha = 0.0;
[UIView commitAnimations];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:#selector(releaseSplashScreen) userInfo:nil repeats:NO];
}
-(void)releaseSplashScreen{
[splashImageView removeFromSuperview];
[splashImageView release];
//Load the rootviewController here
}
You can also include Default.png in the resource of the project
There's a couple chapters on custom splash screens in Drance & Warren's book 'iOS Recipies' from Pragmatic Bookshelf.
Perhaps a commercial plug isn't what you're seeking (I'm not affiliated the the title or publisher), I just remember reading through it and finding it interesting.
You can do a fancy splash screen if you made it on the first view controller, like your real splash screen is the first scene of your animation, and the first view controller is the complete animation then you dismiss the first controller or you push the main view controller after a delay from you first view controller.