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
Customizing search bar in iOS SDK
Hi Readers,
Customizing search bar can be easily done with UISearchBar. All you need to check view hierarchy of search bar subviews for that as with latest iOS SDK hierarchy can get changed. Customizing can be done by changing these views colo...
How to download videos from YouTube in iOS
Hi Readers,
We can download video file from Youtube if we know youtube URL of the video. First you need to add attached files (HCYoutubeParser) into your project. Now you need to call following function into your code:
let video = HCYout...
How to download data Using NSOperations and NSOperationQueue
Hi Readers,
It is sometimes required to download files or images from server into local. We can perform these tasks by NSOperation and NSOperationQueue efficiently. The basic idea is to create each download operation separately and add these o...
How to decode HTML string coming from server to iOS readable string
Hi Readers,
Many time we will get HTML content in our API response which we need to load into our component like UILabel. We can convert this HTML content into normal string or more specifically NSAttributed string which we can set into ...
How to perform task in background thread using GCD
Hi Readers,
GCD stands for Grand Central Dispatch. It can be used to handle background task. In app requirement many time we need to perform some tasks like calculation etc without any effect on main thread. So all we need is to perform that p...
How to implement autolayout programatically in iOS?
Hi Reader’s,
This blog includes the concept of implementing autolayout programatically. This can be done in two ways:-
1.NSLayoutConstraint Class
2.VisualFormat
Below is an example which includes a UITextField ...
Make a simple paint application in iOS
We all have seen a paint application in our PCs or laptops. So, here we are going to build a simple application which uses different colors to draw on the screen :-
Lets start with making the UI. Drag an UIImageView and UIView in the...
How to check metadata of an audio file in iOS
Hi Readers,
The below code snippet will give you the meta data of an audio file. You need to add an audio file in Resource Folder. Once that is done use the below code. Let us also understand the code.
- (void)viewDidLoad {
...
How to blur UIView in iOS?
Hi Reader's,
This blog includes the code which is used to blur UIView in iOS in a very simple way. This code can be used according to the need of the user to blur the UIView. Code is given below which includes how to blur UIView ...
Crop UIImage in iOS
Hello all !
To crop an UIImage in iOS the following code can be used :-
- (void)viewDidLoad {
[super viewDidLoad];
[_originalImage setImage:[UIImage imageNamed:@"Scenery.jpg"]];
CGRect rect = CGRectMake(...
How to use tabbarcontroller and transfer data from one controller to another in iOS?
Hi Reader's,
This blog includes the concept of TabBarController and how you can transfer data from one controller to another. TabBarController is use to manage different content view controller which you provides according to your need. He...
How to save and fetch data from Sqlite database
First include the sqlite file in your project. Then copy that file from bundle to documents directory as below and create Database method.
-(void)createDatabase{
NSString *pathForDocumentDirectory =[self databasePath]; //define new path...
How to store image in cache in iOS?
Hi Readers,
This blog includes the concept of how to store image data in a cache memory with the help of SDWebImageManager. First of all, we need to install pods in the application to use SDWebImageManager, after creation of pod file you need ...
How to show animation with objects
Animation On x and y axis.
If we want to show some moving object on X or Y axis then we can use following code. Here we have taken one view and give some colour to it.
CABasicAnimation *animation = [CABasicAnimation animation];
anim...
How to save and fetch image data from documents directory in iOS
Hi Reader’s,
This blog includes the concept of how to store and fetch data from document directory. You can easily understand the concept with the help of code given below:-
ViewController.h
#import &l...
How to use AFNetworking to make a server call in iOS
Hi Reader’s,
This blog is to use AFNetworking to make a server call with the help of API. Here we are using an API which includes GIF images and other related data. So below is the code used to get response from server. Before ...
Passing data using NSNotificationCenter
There are different ways for passing data between controllers in Objective-C. In this example we are going to use NSNotificationCenter for passing data from one view controller to another view controller. NSNotificationCenter is generally used to...
How to save and fetch record from NSUserDefault in iOS?
Hi Readers,
This blog includes the concept of NSUserDefault which is used to store a small amount of data in it. Now the question arises if we already have SQLite database to store data then why do we need NSUserDefault?
The answer is other...
How to convert NSData to UIImage in iOS
Hi Readers,
This blog includes the concept of converting NSData to UIImage with the help of a very simple example. Given below is the screenshot and code which is used to convert NSData to UIImage on button click. Snapshot of storyboard is g...
UIActionSheet in objective c
We can show the action sheet by using following code. In the below code we displayed the action sheet on button action.
- (IBAction)actionSheetButtonAction:(id)sender {
UIAlertController *obj1=[UIAlertController alertControlle...
How to fetch data from SQLite in iOS?
Hi Readers,
This blog includes the concept of how to fetch data from database after saving the data. You can go through with previous blog if you are not aware about how to save data How to save data in SQLite. Now we will discuss the ...
How to display collection view cells based on screen width dynamically in iOS?
Hi Readers,
In this blog we will get to know how to resize collection view cell dynamically and according to the screensize of iPhone.
Here is a very simple code given below to perform this task in a very easy way. We will use a method insi...
LIVBubbleMenu for iOS
We can create animated and customisable bubble menu for iOS using LIVBubbleMenu. Here is a link from GitHub for the project https://github.com/limitlessvirtual/LIVBubbleMenu-iOS.
In the following example we are going to show bub...
How to save data in SQLite database in iOS?
Hi Readers,
In this blog, we will discuss how to save data entered by a user in SQLite database. Before proceeding towards the saving of data into the database you should know how to create a database and tables inside SQLite database.
...
Send e-mail in iOS
Email application of iOS device helps in sending emails. We can compose Email using MFMailComposeViewController in iOS.
A standard interface that manages the editing and sending of email message is provided by the MFMailComposeViewController cla...
How to share posts in Facebook by using SLComposeViewController in iOS
We can share post in Facebook by using following steps:
Add one button on ViewController and give action to it.
Import #import <Social/Social.h>
Now in button action write following code.
- (IBAction)facebookButtonAction:(id)...
How to share posts in twitter by using SLComposeViewController in iOS?
We can share posts in twitter by using following steps.
First add one button on view controller and give action to it.
import one in your project that is-> #import <Social/Social.h>
Now in button action write following code->...
How to find hours between two NSDate objects?
We can find the hours between two dates by using NSDateFormatter. NSDateFormatter provides formatting and conversion methods for NSDate objects. In below code, I have used formatter to convert the start date and end date into hours and minutes wh...
How to present a UIViewController from top to bottom in iOS?
When we present the viewcontroller it slides from bottom to top but, if we want to change the slide position then we have to use the animation for the UIView. By using animation we just change the frames of UIView.
If we want to present ...
How to find number of days between two dates
Below code is used to find number of days between two dates
NSDateFormatter *startDateformatter = [[NSDateFormatter alloc]init];
[startDateformatter setDateFormat:@"dd-MM-yyyy HH:mm:ss"];//setting date formate
NSDate *start...
KeyboardWillShow and KeyboardWillHide
When we click on TextField keyboard lifts up but if our text field is at bottom then we are not able to see it so with the help of NSNotificationCenter we can solve this issue.
Add one TextField in ViewController, give bottom constraint ...
CNContactPickerViewController
CNContactPickerViewController is used to show contacts in TableView. It allows the user to select one or more contacts (or their properties) from the list of contacts displayed in the contact view controller (CNContactViewController).
...
Glow UIButton titleLabel on selection of UIButton
Hi all ! If we want to show the glowing effect on the UIButton i.e when you are selecting the UIButton then the titleLabel will glow and when its not selected the titleLabel will again come to its original color.
Here is an example which shows...
How to use .xib file for custom UITableViewCell?
Here is an example for creating custom .xib tableviewCell :-
Create a new file and when the window appears then first select USER INTERFACE from the menu appearing on left side and then select EMPTY file and create it. The .xib file ...
NSNotificationCenter
An NSNotificationCenter is used for broadcasting information within a program. It is like television broadcast where messages are broadcasted throughout the program. We can send the notification when some event occurs.
For example, There is no...
PopOverView
PopOverView is used to show the pop up menu. To implement PopOverView first we have to embed navigation to the view controller and take one another Content view controller to show the popup data. Take one button in view controller and give acti...
REFrostedViewController
RefrostedViewController is used to show the side menu.
For Refrosted View controller first we have to install pod ,we can install this version i.e pod 'REFrostedViewController', '~> 2.4’.
We need one Root Controller i...
How to show delete button on UITableView on swipe left ?
One of the commonly used feature in UITableView is to show delete button on the swipe of the table view cell and perform the delete operation. Let us take an example to understand and implement this :-
Begin by creating a new project and assig...
HealthKit Introduction
Hi Readers
This Tutorial is a brief introduction about the new feature introduced in iOS 8 ,that is, HealthKit.It gives us the way to store and retrieve a user’s health data.
Before using this HealthKit let us go through the app via w...
How to use the built-in camera of the iPhone ?
To use the built-in camera of the iPhone consider the following example. In this example we will also see how to access the photo library and select a photo and use it.
Create a single view application and assign a name to it. Then in the Main...
Collection View
Collection view is used to show data in a grid form. It is similar to table view where we have to implement its data source and delegate methods.
In this example, we will implement collection view.
Drag a UICollectionView to the d...
How to create a UIPopoverView programmatically in iOS 9
To create a popover view
Go to your storyboard, set a button in view controller(on click of this button we will pop a popover view).
Make an IBAction form this button to your view controller
eg:- (IBAction)popoverBu...
Line Break on UIButton Text
It is possible to set number of lines of a label by going to the Attribute Inspector and assigning value 0 to the lines attribute.
In case of Text Field we can use Text View but if we are using UIButton then there is no option for the mu...
How to create your own search bar in Swift (Not using UISearchBar)
Here is a small example of custom search bar
1. Go to storyboard, take TextField place it at below navigation bar (we will type text here to find any string)
2. Set delegate of TextField
Come to ViewController class now
Create I...
How to use UIStackView in iOS 9.0
Stack View is a class that allows you to layout views either a vertical or horizontal manner. It saves us from use of constraints in auto layout. We simply embed our views to StackView to make it work. Stack View manages the layout of its su...
How to make some part of string bold in UITextView or UILabel?
If you want to set some part of the UITextview to BOLD then you can implement the following code :-
NSString *str = @"I belong to Dehradun"; // default string
NSMutableAttributedString *attString=[[NSMutableAttributedStrin...
How to use NSAttributedString in UITextView?
We can use attributed string with textView by following steps -
1. Make a IBOutlet of your textView
for eg -
@property (weak, nonatomic) IBOutlet UITextView *textView;
2. Now go to storyboard and select your textVi...
How to use Core Data in iOS Part 1?
Core Data framework is used to store data in the form of entities and maintained by Apple in a very well defined manner. Here is an example usage of Core Data to insert,delete,update and fetch data from entities with in the same. To use Core Data...
Delegates in iOS
Means of communication between the objects can be implemented using Delegates. One object can send messages to another object through delegates.
For example, if we want to pass data forward then it is easy through UINavigationController as...
Side MenuBar in iOS
Side MenuBar or menu list is used to provide a list to the user so that user can easily move to those pages according to the need. Here is an example of including menubar in the application with the help of a superclass REFrostedViewCot...