Archive for April, 2012

Open A Link in Safari from Your iPhone Application

A very basic functionality you can add in your application. this post is all about how can you push a link on the Safari from your application.

Implementation is pretty simple. You have to use openURL and bang you are done with it. Here is the example :-



[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @""]];


Hope it helps.


, , ,

Leave a comment

Take Screen-shot of Current View and Attach it to Mail

Hello Everyone,

This is my first tutorial for iOS Developers. I am starting with the very basic application cum functionality which is “How to take screen-shot of the current view and attaching it to the mail?”.

I have made a separate class named “CommonAPI” which will be very easy to use in your projects.

In this CommonAPI class I have written the methods which will get the screenshots and simply give the image to you. Then you can do whatever you want.


#import <Foundation/Foundation.h>

@interface CommanAPI : NSObject {


//+ (UIViewController*)viewController:(UIView*)iView;

+ (UIImage*)makeScreenShot:(UIView*)iView;




#import "CommanAPI.h"

#import <QuartzCore/QuartzCore.h>

@implementation CommanAPI

+ (UIViewController*)viewController:(UIView*)iView{

for (UIView* next = [iView superview]; next; next = next.superview) {

UIResponder* nextResponder = [next nextResponder];

if ([nextResponder isKindOfClass:[UIViewController class]]) {

return (UIViewController*)nextResponder;



return nil;




[iView.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *tmpImage = UIGraphicsGetImageFromCurrentImageContext();


return tmpImage;



return (M_PI * (x) / 180.0);



Download Source Code

Output :-

This slideshow requires JavaScript.

Leave a comment