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
Send mail using iOS
Sometimes we need to send the email from iOS application for that we have to integrate MFMailComposeViewController in our application so that we can send email.
This program will help you to send email through your app using swift.
Steps Requ...
How to check null value in NSDictionary
Hi ,
If you want to check the null values in NSDictionary then use the following code :
id value = [dict valueForKey:akey];
if (value == [NSNull null] || value == nil ||
value == NULL ||
value == Nil ||
[valu...
Create dictionary using array first letter
we often come to a situation where we have to create the dictionary based on the alphabetic order.
So here is the program for creating a Dictionary with first letter of the array element. array element First letter is a key for adding the ele...
How to show alert view in Swift (iOS8) with OK and Cancel button?
To show an alert view in swift while using iOS8.
Here is an example of how to use it:
var MyAlert = UIAlertController(title: "Logout", message: "Are you sure?", preferredStyle: UIAlertControllerStyle.Alert)
var MyOkayAction = UIAlertAction...
Difference between 'var' and 'let' in swift programming language
In Swift, both defines a variable.
The let keyword define a constant like
let api_key = 42979
The api_key cannot be changed afterwards; Its value is set once and only once
The var define an ordinary variable that hold the data like
...
How to show an alert view in Swift Programming Language?
To show an alert in Swift programming language, you need to first import the UIKit framework then use UIAlertController object.
A UIAlertController object displays an alert message to the user.
Important: UIAlertView is deprecated in iOS 8....
Select Image from Device
Hi,
If you want to select image from device in Xcode, you can use the below code for this.
#import <uikit.h>
@interface ViewController : UIViewController<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
{
...
Loops(Control statement ) in Swift
For loop:
In swift there are two types of for
loop:
1: for-in loop
for-in loop with Array:
let myIntArray = [
10,20,30,40,50,60,70];
var index = 0;
for value in myIntArray {
println(" MyIntArray[\(index)]=\(value));
...
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 iterate or remove all key object from NSUserDefaults
Hi Readers,
In any iPhone app if it is needed to iterate or remove NSUserDefault keys (as in logout feature), following code can be used:
To iterate key objects:
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
...
Handle NSLog in iPhone sdk
Through this code we can use NSLOG whenever required. Write this snippet in some common file(say utility) so that it would be easily handled throughout the project. Make sure class should import utility class to handle NSLog.
All you need is to ...
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...
Tuples in Swift
Tuples is a new concept that is introduced in swift programing. Tuples group the multiple values in a single compound value. It is not necessary that the each tuples value should have the same datatype. The datatype can be different and number of...
Fetch the Contact Detail Using iPhone SDK
In iPhone application development it is required to fetch the contact detail that are saved in the contact list of iPhone.
So here is the program that will help you to fetch the detail of the contact with name number and contact image, if the i...
First swift App launch
Hi ,
If you are starting with swift and want to learn following things:
1) how to declare IBOutlet
2) how to declare property
3) How to declare class variable
4) how to hit http server request
5) how to parse the JSON
Then g...
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...
Singleton class in Swift
Hello reader's !
The singleton class ,which is responsible to instantiate itself, to make sure it creates not more than one instance, in the same time it provides a global point of access to that instance. In this case the same instance can b...
UISearchBar with TableView in iOS
How to use UISearchBar with TableView in iOS
If we have a huge list of items and want to search a item from the list then we use the UISearchBar with TableView and the item will be displayed in the table which have the matching value with the ...
How to implement underline textfield in Xcode
Hi,
The tutorial will help you to set underline textfield in Xcode.
#import <UIKit/UIKit.h>
@interface UnderlinedTextField : UITextField
@end
#import "UnderlinedTextField.h"
@implementation UnderlinedTextField
...
How to play video on click of CollectionView Cell
Hi,
The tutorial will help you to set an image on collectionView Cell and when you click on any image play the video.
//
// ViewController.m
// YouTubeVideo
//
// Created by lalit on 4/7/15.
// Copyright (c) 2015 lalit. All rights re...
Objective-C Program Structure
In this video blog, you will learn objective c program structure and line by line understanding of program.
How to use new fonts in iPhone SDK
Following are the steps to add new fonts which not available in iOS sdk.
1) Download the font file and add that file in resource folder
2) go to App- info.plist and add key "Fonts provided by application" and in value add the name in that fon...
optionally using iPhone OS 3.0 features in a 2.0 compatible app?
We can check if that specific method available in this version of sdk or not.
For example there is method AVCaptureAutoFocusRangeRestriction of class AVCaptureDevice which is available in iOS 7 but not in iOS 6. So to check we can do the follo...
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...
UIImage Cropping in Objc
Some times we click picture from ios camera but it does not return us the same image as appears inside the camera frame. Use below function to get an image of exact size which was visible through camera.
Follow these Steps:-
Step 1. First o...
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...
Setup Facebook app invites of an iOS app
Hello reader's !
If you want to setup Facebook App Invites of an iOS app then follow these steps.
Using Facebook graph API , make a request to get facebook app_access_token (app_access token is not login access_token) . I m using google ...
How to check if the email is valid in iOS sdk
Hi readers,
Many apps require email validation in iOS. Here the function that can be used to check if email string is valid or not. It can be achieved by NSPredicate like following:
-(BOOL)isValidEmail:(NSString *)checkString
{
long n...
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...
Method overLoading In Objective C
**
Method overLoading In Objective C:
**
method overloading concept in object oriented language we use the same method name with the different signature. Signature is the argument that we send using the function.
we just change the number...
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...
Quick reference of swift language comparison with Objective C
Quick reference of swift language comparison with Objective C code
Best way to get iOS, MAC OS version
Many times we need to make check for iOS version as it Apple changes its API from version to version. For this reason Apple provide the safest way to achieve it, which is "NSFoundationVersionNumber". It returns on which version device is running....
Save the other Object in array using for loop
To add the object in array in for Loop we have several methods:
first we can have to simply add those objects to the array then we can add them using for loop in array.....
**IN example:**
we have a simple object *object that we added 3 tim...
How to setup first time launch of an iOS App
Hello reader's !
If you want to setup first time launch of an iOS app.
Using this code the terms and conditions will appears or shown only the first time of app launch.
here is the code below.
I have two UIViewControllers (FirstViewContro...
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.
Change the Page indicator dot in iPhone PageCotrol
To change page indicator dot in iPhone pagecontrol follow the below steps and set of codes.
Open The Xcode and Create a new project Name it as MyPageControl
select the project and right click and add new files and select a cocoatouch File...
Detect network change using Reachability in ios
Following code will help you to detect the change in network availability.
Download the reachablity class from here :
https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html
#import "Reachability.h"
Th...
last online status using xmpp and ios sdk
If you are using xmpp server for live chat messaging and want to know how to get the last online status of your friend. Then use the following method and you will get the dictionary in xmpp delegates method.
-(void)getlasttimeActivity:(NSS...
Flush entity in core data
If you need to delete or flush all the data that exist in core data entity then use this method. Just pass the name of the Entity as a param to this method.
-(void)flushEntity:(NSString*)entityName{
NSFetchRequest *fetchAllObjects = [[N...
Flush core data DataBase in ios
Some times we need to flush or truncate the sqlite Database tables created by coredata.
Here is the method to delete all data which exists in core data sqlite tables.
-(void) flushDatabase{
[self.managedObjectContext lock];
...
Push Notification in ios
Here are the Push Notification Check for iOS8 and iOS7.
iOS Push Notification Check
#define IS_iOS8 [[[UIDevice currentDevice] systemVersion] floatValue] >= 8?YES:NO
if (IS_iOS8) {
UIUserNotificationType types = UIUserNotifi...
Add fadein effect animation for UIImageView
How to add a fadein effect to an imageview in objective C
Hello all,
Many time we stuck in adding fadein effect animation for UIImageView.
to add a fadein effect to an imageview in objective C, please use below mentioned method.
-(voi...
How to add UIView above UIKeyBoard in Objective C
To add an UIView just above the UIKeyBoard write the below mentioned methods to achieve it.
-(UIView *)getTextFieldAccessoryView{
UIButton *cancel = [UIButton buttonWithType:UIButtonTypeCustom];
[cancel setFrame:CGRectMake(0, sel...