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

UIAlertController as an action sheet in iOS8 and above.

Now you can use UIAlertController as an actionsheet in iOS 8 and above versions. Here is an example of it:- UIAlertController * view= [UIAlertController alertControllerWithTitle:@"Sample" ...

How to use UIAlertController for iOS8 and above.

Apple has deprecated UIAlertView in iOS 8 and above. Now they have introduce UIAlertController, below are the examples. AlertView without buttons:- UIAlertController * alert= [UIAlertController alertContro...

ENABLE_BITCODE in xcode 7

Bitcode refers to an intermediate representation of a compiled program. The installation of iOS, tvOS, and watchOS apps by tailoring app delivery to the capabilities of the users particular device. Apple called this optimization,"app thinning". ...

How to check Push Notification enabled in iOS

For your iOS application if you want to check Push Notification status then you can check it by using the below code:- in iOS 7 UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; if (types ...

Add a thin line to UITextField in iOS

For textfield we use attributes to give outlines to it or some times we place image view behind every textfield for its outline. We can instead use CALayer for it. I am setting an upper outline to a textfield, here is the code:- CALayer *upper...

How to create a custom UITableViewCell separator in iOS

In UITableView every UITableViewCell contains a separator line by default. If you need to create your own custom separator line then use below code inside cellForRowAtIndexPath method. UIView* separatorLineView = [[UIView alloc] initWithFrame:...

How to create a custom back button in iOS

Some times we need to create a custom back button for Navigation Bar in iOS. If you want to create an easy navigational back button instead of creating a view and add that view in navigation bar then use below code to achieve it. UIButton *bac...

Hide Status bar in iOS

In iOS apps when we need to hide control center appears in iPhone device on swipe up gesture or forced to hide UIStatusBar then use below code. Write below lines in your viewDidLoad method. if ([self respondsToSelector:@selector(setNeedsSta...

How to check BOOL value of Parse Object in iOS

If you are a beginner in Parse SDK and integrating it for the first time then you may face this little hurdle. While fetching Boolean data from Parse DB we get BOOL value in NSNumber format and we can not check or compare it directly with iOS bo...

Custom message for Location permission alert in iOS

If you are using Location Manager to get user's current location then you have ask Location Permission first. iOS provides you access to user's location if user accepts it. Here is the code :- Below code will return you location manager object...

Check a string with special characters in ios

If you want to check any NSString containing special characters then check this out. -(BOOL)specialCharacter:(NSString*)username{ NSCharacterSet *invalidCharSet = [[NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTU...

Email Validation in iOS

While creating any Login or Registration UI in iOS we ask user to enter their email id. To avoid wrong data entry we can validate entered data by using a simple validation method. Below method will return you a BOOL value. Here it is:- -(BOOL...

How to use predicate in ios

In iOS we can use Predicates in order to get fast response. Mostly iOS developers use Predicates in search functionality to filter it as user types in search bar textfield. Let suppose you have an array named as youDataArray which contains s...

How to take a screenshot of an iPhone screen in iOS

Some times we don't get a correct screenshot of an iOS device. Specially when we apply some transform or animation. If you are applying affine transform or 3dTransform to an object and hoping for a perfect screenshot with same transform value the...

How to save image in to gallery in iOS

If you want to save any UIImage to iPhone or iPad gallery, just use below code to achieve it. These lines of code will write image file to your gallery. You just have to pass UIImage as param to it. UIImageWriteToSavedPhotosAlbum(yourUIImage,...

Reset any transform in iOS

In iOS when we apply transform methods to any UIView element like UIIMageView, UIView and all those UI Elements which inherits UIView properties. After applying transform to these views they get change and holds new transform values. In that case...

How to get device token in iOS

For iOS push notification services functionality we need a device token (a unique device id generated by device OS for Push Messages communications) on which we can receive push notification messages. To generate the device token we have to add U...

How to get iOS device type and version

If you need login device type, model and version of an iOS device, then use below code. You'll have to import below file first then:- // #import `<`sys/utsname.h> NSString* deviceName() { struct utsname systemInfo; uname...

Facebook Login in Parse

Parse provides simple Facebook login where it saves Access Token and limited user info. Inside your viewcontroller where you have implemented PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate delegates just call Facebook request as m...

Simple way to change status bar

If you need to change the color or appearance of the Status Bar of iOS then follow simple steps. in your code file where you had created or initialized UINavigationController just write few line of code there. Find similar line as mentioned...

How to add a Podfile in your Project

Below is the step-wise process for integrating a Podfile easily in your Application. Open Terminal Change the directory in Terminal to the location where your Xcode project resides. When you reach to the desired project location in which ...

How to upload image in Specific folder of your application iOS

Here is the code for UIImagePickerController Delegate. In this Code when we select an image from UIImagePickerController then we call this delegate function which upload the selected image to your local application folder. You have to first find ...

Set date of a Date Picker in Objective C

In objective C, UIDatePicker is the best way to display date and time options. We can set date of our choice in a Date picker. Also we can set minimum and maximum date. Here I am creating UIDatePicker first. UIDatePicker *pickerDate...

Reverse an array in Objective C

If you want to reverse an existing array in objc, you can do it this way. - (NSMutableArray*)reverseArray { if ([self.assetsArray count] == 0) return; NSUInteger i = 0; NSUInteger j = [self.assetsArray count] - 1; ...

Redirect to app settings in iPhone

If you want to redirect to app settings from your app then use below code to do it. Apple provides a list of URLs to redirect the app to its setting section. Here is the code :- In a Swift Program:- UIApplication.sharedApplication().ope...

Zoom in an UIImageView using 3D transform in objc

If you are looking for a function to Zoom in an UIImageView in a 3D tranform scale then you should use CATransform3DScale. First of all declare a BOOL variable to check scale points. Here I am taking CGFloat _scalePoints and CATransform3D tr...

UIButton width according to Title text.

We can increase or set width of a UIButton according to button title test. To set the width of a UIButton use CGSize. Here is the code :- CGSize stringsize = [yourButton.titleLabel.text sizeWithFont:[UIFont systemFontOfSize:17]]; [yourButto...

How to convert NSData to NSString or vice versa in Objective C and Swift

Hi Readers! In this blog you can find both versions (Obj C & Swift) for converting NSData to NSString or vice-versa. Objective C NSString * str = @"Hello"; NSData * data =[str dataUsingEncoding:NSUTF8StringEncoding]; NSLog(@"Data = ...

DropBox Login Integration Using iOS SDK

Download the DropBox SDK from the https://www.dropbox.com/developers/sync/sdks/ios add this sdk to Your project and also add some other Frameworks. 1. Foundation.framework 2. UIKit.framework 3. CoreGraphics.framework 4. QuartzCore.fra...

Fetch profile pic from Facebook

For some reasons Facebook doesnt provide profile picture with user info dictionary/data. We need to fetch profile pic using graph api. Once user is done with successful authentication he can use following snippet to get profile picture URL. ...

How to integrate PAYPAL for future payment

Hello Readers To integrate PayPal in an ios application for future payment , the following steps need to be followed: Step 1: Download the PayPal ios sdk from the link given below: [https://github.com/paypal/PayPal-iOS-SDK][1] Step 2 : ...

How to get Common Values from two Arrays

This is a simple method to compare two arrays and get all the common objects from these arrays. Take two arrays(say firstArray & secondArray) NSMutableSet* arraySet1 = [NSMutableSet setWithArray:firstArray]; //create NSMutableSet for f...

Add Input Accessory View above UIKeyBoard in iOS

If you come across a requirement where you want to add a custom view just above the UIKeyBoard, then you can use below code to do that. If you want to show custom view on tapping inside any UITextField or UITextView, Write below line of code i...

How to give background color to superview only with alpha less than 1.0

Hi, In many cases we have to give a background color to a superview with alpha less than 1.0. If we give color from XIB/storyboard to a superview with alpha 0.4 then it assigns the alpha 0.4 to its subviews also. What if we need to give al...

How to set Camera view aspect ratio in ios

Some times we face problem with Camera view aspect ratio in ios. Solution to this problem is here.. Set its aspect ratio property to AVLayerVideoGravityResizeAspectFill. It actually preserve aspect ratio; fill layer bounds. AVLayerVideoGr...

Change color of an UIImage in ios

You can pass array of colors in this function in order to change any color of an UIImage. Just pass UIColor and UIImage to this function. +(UIImage *)changeColorTo:(NSMutableArray*) array Transparent: (UIImage *)image { CGImageRef rawIma...

Change UIIMage background color in iOS

Here is a function which returns an image with different background of you choice. - (UIImage* )setBackgroundImageByColor:(UIColor *)backgroundColor withFrame:(CGRect )rect{ // tcv - temporary colored view UIView *tcv = [[UIView alloc] ini...

Make UIImage White Background Transparent in iOS

If you came across to a requirement where you want to make UIImage Background Transparent then use below method to achieve it. +(UIImage *)changeWhiteColorTransparent: (UIImage *)image{ CGImageRef rawImageRef=image.CGImage; const CGFloat c...

Autoplay media files in UIWebView in IOS

When displaying media content using HTML5 in a web view on IOS the autoplay functionality does not work. To enable to web view to autoplay the media (if coded in HTML to autoplay) you need to add a line of code in your IOS application as expla...

How to share post/pics/link using IOSLinkedInAPI

Hello Reader's, I m using IOSLinkedinAPI to Share Video link to LinkedIn. But i m giving option to share picture URL , links and text post to LinkedIn. Install AFNetworking using pods. Download IOSLinkedinAPI and drag-drop "IOSLi...

iOS kV difference between self.variable and _variable

Variable names starting with _ are instance variables of that class. self.variable is calling a getter/setter method on your object. The class must be key-value coding compliant for the property, as specified in Ensuring KVC Compliance.

How to get sub strings from a string using Regular Expression

Hi, The below code is to get substrings from a string. You are going to love this below code which is very simple but very effective. I have used regular expression to get the sub strings. NSString *strTest = @"Hii how are you doing @Ravi , h...

When to use copy Attribute in declaring a property in objective c

We all use attributes in Objective C to declare properties. Attributes commonly used are strong, nonatomic, weak, assign. But we never take it seriously why we are using these attributes. One of the common mistakes I often see is the wrong us...

Rounded corner in XIB or storyboard

Hi, I am writing for the first time on FindNerd. Many times we need to make buttons, labels, imageview, view to have rounded corner. and we write code as below to perform it. [redButton.layer setCornerRadius:15.0f]; [redButton.laye...

Tabbar Customization

Snippet works all around to customize the tabbar icons & texts display color for selected and unselected state for iOS7 self.tabbarController.tabBar.tintColor = [UIColor greenColor]; Below code can be used to customize the text look. ...

Fetch All Notifications

Snippet to fetch all local notifications of the app. One can customize any notification and cancel the same. UIApplication *app = [UIApplication sharedApplication]; NSArray *eventArray = [app scheduledLocalNotifications]; for (int ...

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...

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....

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...
1 5
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: