Featured
-
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi -
Make UIImage White Background Transparent in iOS
If you came across to a requirement where you want
by ashish.nakoti -
User's location update on server when app is in background.
Code for those Apps where we need to update user's
by ashish.nakoti -
Animate button with zoom and bounce effect in ios
Many social apps are using bouncing effect for but
by ashish.nakoti -
Crop an image from UIImageView
With the following method stated below you can cro
by kuldeep.butola
Tags
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...
Play a video from a URL in iPhone SDK
To play a video from a url in iPhone sdk just write down following line of code:
Step 1: Create a MPMoviePlayerViewController object as *moviePlayerController.
Step 2: Create a Url and initialize your movieController with Url.
Step 3: and No...
Round or Circular ImageView in iOS
You may have seen several mobile applications with round or circular image view. It is mostly used while displaying User's profile pic or in a tabular representation of images. You can do it very easily without using third party classes or Librar...
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...
Custom Check For iPhone , IOS Version , Email And Phone Number in swift
Hello Readers,
These are some of the custom checkers to detect
iPhone
Current IOS Version
Email Validation
Phone Number Validation
For iPhone 4 and 4s :-
func isIPHONE4() -> Bool{
let screenSize: CGRect = UIScree...
NStimer in Objective C
Hi,
In this video blog, we will learn how we can use NSTimer in Objective C.
NSTimer class to create timer objects or, more simply, timers. A timer waits until a certain time interval has elapsed and then fires, sending a specified message ...
How to Change the Font and Color of UITextField's Placeholder
Hi Readers,
Below are two simple lines you need to add to your code for changing the font and color of the UITextField's Placeholder.
_txttest.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:30.0f];
_txttest.attribut...
NSdictionary in Objective C
Hi ,
In this video blog, we will learn how to use NDdictionary in Objective C
Slide-Out Side Bar Menu/ Hamburger Menu
Slide-Out Side Bar Menu/ Hamburger Menu
One of the useful implementations of menu views has been the slide out side bar often known as basement,side drawer or side menu it is vastly used & is popular in Facebook app and Path.When the us...
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 ...
Objective C NSarray
Hi,
By this video tutorial , you can learn how we can use the array in objective .
Important checkpoints before uploading the iOS App for Approval
Getting the approval from the Apple store for iOS App sometimes become a very difficult and long task. The reason for that is threefold:
...
Download Files Using DropBoxSDK in iOS
If You want to get the list of all the files that are uploaded on your DropBox then use the following code :
method -(void)downloadAllData:(void (^)(NSMutableArray *, NSMutableArray *, BOOL))
block need to be called after the successful lo...
Invalid attempt to access ALAssetPrivate past the lifetime of its owning ALAssetsLibrary
When accessing assets in the iPhone, some time users gets this error.
(Invalid attempt to access ALAssetPrivate past the lifetime of its owning ALAssetsLibrary)
so we can initialize our assetLibaray using the following code:
+ (ALAssets...
Creating .p12 for apns with server side in Java
Generally in iOS apps server side is coded in PHP and to integrate APNS we can create .pem file by following this RayWenderlich tutorial.
But we might face difficulty in receiving remote notification on device when server side coding is done i...
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...
Objective C simple block declaration and implementation
In this video tutorial , You will learn how we can implement Objective C block.
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...
Trim whitespace from a NSString in ios
If you want to trim occurrence of whitespace character from both ends of a NSString. Use below code to do it:-
NSString *newString = [yourString stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceCharacterSet]]...
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...
Starting a table view from the bottom of the screen
Hello Readers,
In case you want to start a table view from the bottom of the screen rather than the top of the screen, you may call the following method from the delegate method as follows:
- (void)updateCellInset {
NSInteger numRows=[...
Fetch Profile Picture From Google Plus
Hello Readers,
After the successful authentication from google plus , the following code snippet is one of the ways that can be used to get the url of the profile image:
- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth
...
Blur image using objective-c and swift
Hello Reader's
If you want to blur image in objective c and swift then copy this code in your project and just call this function. In this code , Blur effect is 50 percent .
For Objective C :-
-(UIImage *)convertToBlurImage:...
Category on View to animate subview like popup in iPhone sdk
Hi Readers,
In our app we usually make custom alerts which we need to animate at the time adding it on its superview.
To achieve it with you custom view make a category like this :
Put this code into your .h file of category named as...
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.
...