Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

How to handle UIPanGestureRecognizer and moving your all images w.r.t moving image.

The following code help your image to move using UIPanGestureRecognizer. While moving your selected image other images set there location automatically. -(void)addImageToScrollView { float x=5,y=40,width = 100,height = 100,spaceH = 5...

ASIFORMADATA uploading Bar

Hello Guys, There are different issues while uploading a video to a server. -videoSize video Quality. Now uploading depends on internet speed and file sizes and it can take almost a minute to upload a video. Developers use Activity Indi...

Get Date Interval in iPhone

Compare two dates to get number of days without calculation. 1 day = 86400 seconds.. NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"EE LLL d,yyyy"]; NSString *dateStr = @"Tue Dec 17, 2013"; N...

Mandatory and optional methods in protocols

The methods and functions of the protocols can be categorized as, required or optional. The difference between these two specifiers is that, the programmer may or may not use the optional methods declared in the protocol, or may use some of them ...

Adding custom annotations to a map

Annotations are little images(pins by default) that are to used to mark a point of interest in a map. But occasionally the programmer might need to use custom views or images instead of boring pins. This can be easily achieved by creating a image...

Difference between @"MM/dd/yyyy" and @"MM/dd/YYYY" in setDateFormat.

The difference may seem very small but it makes a lot of changes in the ways things work.The year when written in small letters (setDateFormat:@"MM/dd/yyyy") is the ordinary calendar and will return normal year, but in case of the capital YYYY, (...

Check Null data parameter in json array or dictionary object in iPhone

If some parameter is missing in json or dictionary. For example- json = ( { "created_time" = "2013-11-18T14:40:37+0000"; from = { id = 15400100; name = "Alexandra"; ...

Remove Data from doucument Directory ios

Hello friends, I was using to document directory to save images and video and after saving a lot my app use to crash due to memory warnings. So there is a way to delete content of document directory. -(void)deleteDD { { NSLog...

Importing Fonts to XCode

iPhone provides number of fonts for developing the app but not all. Sometimes we need to go beyond the fonts provided by iOS sdk. Following steps will do the needful 1) Add desired font to project (It must be .tff or .otf); 2) Go to info....

Date Picker embeded in UIActionsheet with toolbar

Sometimes a user is required to input a date in the application for example to provide the date of birth. The programmer have to make sure that the date entered by the user is in correct format that can be used by the app or the server. If a nump...

Create audio file manually

We often come across conditions where manual audio file is to be created. For example recording an audio or download audio data from server. These all need audio file in which data is to be populated. Below, I'm creating an sound.caf file and...

IPhone alert view

To show alert view in IPhone, the following snippet will help you. UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Message" message:@"Network error. Try again?" delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil]; ...

UIImagePickerController

Often it is required to integrate the iPhone's camera in the app to take pictures and photos to be used by the app. This is made possible by UIImagePickerController. The UIImagePickerController gives the programmer the capability to integrate ...

Paint app with undo functionality

One way to add undo functionality to a paint app is by storing state of the view and taking the view back to previous state on undoing. We can store state in arrays. And the state here will be all the lines being drawn and properties of the lines...

Handling audio files in iOS 7

The general idea for playing an audio file in iOS 6 was to create an object of AVAudioPlayer and pass the file path to it as follows: NSURL *fileURL = [NSURL fileURLWithPath:audioFilePath]; player = [[AVAudioPlayer alloc] initWithCont...

Get a rotated image

A very good stuff that allows you to get rotated image. Sometimes we rotate the UIImageView, it appears like image is rotated but in actual it's the UIImageView which is being rotated. If we try to fetch the image from rotated UIImageView it will...

Customized back button

The default back button in the navigation bar that pops the current view and takes the screen to the previous ViewController, can be easily customized and made to look fancy, trendy and in relation with the rest of the theme of the app. This i...

How to make a paint/drawing app in iphone

With the help of Core Graphics Framework and touch methods of UIResponder we can easily draw on iphone screen. There are two ways to do this : Either create a UIView subclass and draw directly on it, or use imageview from the View controller....

String with different colors in iPhone

Using addAttribute method we can add different colors to a string for certain range of characters in that string. Label.text = @"Ashish"; NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithAttributedString: Label...

How to use later method of iOS version with earlier iOS base sdk

What if you want to build the iPhone app with iOS sdk 6.0 and want to use some method of iOS sdk 7.0? There is no such way in Xcode to build the app using two different versions of iOS sdk. If you use any method which is available only in...

Convert NSString to NSUrl

Hello, Convert a NSString to NSUrl If you want to convert a NSString to click able Url then you have to use this code using escape dataString. NSString *string= [NSString stringWithFormat:@"https://maps.google.com/"]; NSString...

gesture recognition - Pinch, Pan, Drag and Rotate.

The evolution of touch screen devices has been very rapid along the recent years. One of them is the gesture recognition. The gesture recognition technology is able to recognize many type of gestures made by a single finger or even a multi-finge...

dynamic searching in a UITableView

Sometimes a UITableView needs to have a lot of rows of information. The main problem that arises with having a table view with lots and lots of rows in it is the accessibility of the rows. Imagine a contact book in your phone with 500+ phone numb...

Change background and font of UIWebView

To change the Background color, Font color, Font style in UIwebview, follow the following line of code. [webview loadHTMLString:[NSString stringWithFormat:@"<html><body style=\"background-color: red; font-size: 15; font-family: Helvet...

Multiple TableViews in a ViewController

Adding a UITableView in a ViewController is a great way to display data and information in a list, and it is easy to implement as well. The problem arises when the developer have to implement more than one table views in a viewController u...

How to create Singleton class

Sometimes, we need access of some object /data/ variable globally throughout the App. In that case, creating a singleton class which can be accessed through out the app is helpful. App Delegate is a good example of singleton class. After goog...

Share video on Facebook using ASIFormDataRequest

In facebook graph API "https://graph.facebook.com/" url is used for all APIs. But to post a video on facebook an other API url is provided. To post video on facebook you must use "https://graph-video.facebook.com/me/videos" API. Below is the c...

Share image on facebook using ASIFormDataRequest

Below is the code for sharing photo on facebook using ASIHTTPRequest. - (void)publishStoryWithImage:(UIImage*)image andMessage:(NSString*)message { NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/photos"]; ASIForm...

UITableView extra spacing(padding) on the top in IOS7

When using xcode4.5 or 4.6(i.e ios6) UITableView added to xib files appears as it is. But when it comes to IOS7(i.e When you are using xcode5) along with adding the UITableView to xib you also need to add a small code which will remove that paddi...

How to get user image from Foursquare IOS sdk

Foursquare authenticate API returns all the information related to user's fourSquare account. In this response under "user" tag there is a tag "photo" with two other tags "prefix" and "suffix" like below. photo = { prefix = "https...

Read Google+ Activity publish date in NSDate object in IOS

In Google+ IOS sdk activities API return the activity published date in following format. "2013-11-22T11:31:47.269Z" You can use below line of code to read this date in a NSDate object. NSDate *activityDate = [[GTLDateTime dateTimeWithRFC333...

Get all Facebook chat messages in iPhone

Note :- Facebook provides only 25 latest chat conversation messages /This is completion handler method and takes 3-4 sec to load chat messages from FB/ NSMutableArray *arrConversation = [[NSMutableArray alloc]init]; NSArray *arrPermis...

Get Facebook permissions status in iPhone

After requesting facebook permissions we can check facebook permissions status using following code. [FBRequestConnection startWithGraphPath:@"/me/permissions" completionHandler:^(FBRequestConnection *connection,id user, NSError *error) { ...

Convert Facebook Datetime format in iPhone

Convert date format - 2013-10-31T07:41:39+0000 to 2013-10-31 01:48:11 +0000 NSString *dateString = [stringDate substringToIndex:19]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.timeZone = [NSTimeZone localTimeZo...

Camera Simulation in iOS Simulator.

Every now and then the Xcode developers have to make use of the iPhone camera to click pics, photos and even different types of symbols and codes like bar code and more recently the QR Codes (Quick Response codes). The primary problem faced by...

Get all image assets from iPhone Image Gallery

Write following code in .h file Add first the assets library framework from BuildPhase -> Link Binary with libraries import framework in .h AssetsLibrary/AssetsLibrary.h Declare properties @property (nonatomic, retain) ALAsset...

Convert date into specific day of week

The following code is to convert day into specific day of week like Sunday , Monday , today , tomorrow etc. and after 7 days you want to show only that date, then this code will help you. NSDateFormatter *formatter = [[NSDateFormatter alloc]...

Change day in date through coding.

The following code changes the day from the given "date" for example: if you want to add or subtract 5 days from the date put a value 5 or -5 respectively for "timeSliceDay". -(NSString *)getTimeSliceDate:(NSString *)date format:(NSString *)fo...

low sound when recorded audio is played

Sometimes we record audio from AudioRecorder and when we play the same audio, it runs with a quite low volume even if volume is set to 1.0 i.e maximum. Use below lines of code to avoid such issues: AVAudioSession* audioSession = [AVAudioSessi...

Using Property Lists (Plists)

Method to get a value from plist NSString *path = [[NSBundle mainBundle] pathForResource:@"PlistX" ofType:@"plist"]; NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path]; int number = [[[[dict objectForKey:@"One...

Some helpful date related code

Get a date after n days -(NSDate*)getNextDayAfterDays:(int)numOfDays from:(NSDate*)date { NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *offsetComponents = [[NSDateCom...

Cropping image without degrading their quality (Using CIFilter's CICrop filter)

The below mentioned code uses CIImage library's CICrop filter to crop the desired area from UIImage. The follwing code deoesn't deals with snapshot as CGContextRef rather crops the original image along with maintaining its quality and aspect rati...

Crop Images without degrading their quality (Using CGContextRef)

Often the images cropped from other images in iPhone SDK are degraded in quality. This is because we take a snapshot of the original image (of the desired area). But the below mentioned code prevents from happening the above mentioned issue. The ...

How to Animate UIView

The following code sets the desired frame to a view with animation. The animation is performed with a duration of 0.4 secs (can be set according to the requirement). [UIView animateWithDuration:0.4 animations:^{ [animateView setFram...

Avoid Strong Reference Cycles Objective C iOS sdk

How to Avoid Strong Reference Cycles Avoid strong delegates Avoid strong IBOutlet Avoid strong reference variable inside the Blocks Although strong references work well for one-way relationships between objects, you need to be carefu...

Memory management under ARC

ARC Memory management 1)Methods you cant call (or override) anymore You will have to remove all calls to these methods without substitution: 1)retain 2)retainCount 3)release 4)autorelease 5)Dealloc You also cant use the re...

increase and decrease iphone volume

If you want to increase the volume of iphone in a specific app and then reduce it to it's current volume. The following code might get helpful:- (NOTE:Include FrameWork: MediaPlayer.framework ) -(void)exampleFuctionSample{ NSLog(@""); [s...

Sorting

NSSortDescriptor *frequencyDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"" ascending:NO comparator:^(id obj1, ...
1 11 13 next
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: