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
Objective-C or Swift: Which Technology to Learn for iOS App Development?
Introduction
It’s no argument that mobile platforms are kicking desktop computers out of the limelight and according to the most recent statistics, these will gain a significantly greater offer of the market in th...
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on general purpose, a multi-paradigm compilation which has been developed by Apple Inc. Swift is basically developed for various operating systems including iOS, watchOS, macOS, Linux, and tvOS. It i...
Pass Data from One ViewController to Another in iOS Objective C
Hi, guys, today will learn how to pass data from one view controller to another in iOS
1. First & foremost you have to analyse the type of data that is in your first ViewController that you have to pass ahead to the next view controller.
...
How to add records into Firebase in iOS sdk?
Hi Readers,
Many developers use third party SDK for saving records into the Database, Firebase provides us this functionality. To add records into Firebase, please follow these steps:
First of all, you need to create a reference to Firebase...
How to Display banner ads for DFP users in ObjectiveC
This blog includes how to display banner ads for DFP users.For this first user need to signed up as a DFP (Double click for publisher) and then install cocoa pods for Google mobile ads.
pod 'Google-Mobile-Ads-SDK'
We can also in...
Generate random number without repetition in ObjectveC
This blog includes generating the random number without repetition of number in specific range.
For this we need to take a array to store the generated number so that we can keep track that the number is already generated or not.
Here is th...
How to get the image size after aspect fit in objectiveC
When we set the aspect fit property of image view then the size of image get reduced because it sets the image according to the aspect ratio. So if we want to get the size after aspect fit the use the following code-
In the following cod...
How to animate view zoom and bounce like popup in objectiveC
This blog includes zoom and bouncing In animation on view. If we want to present view like popUp alert then it include two animation-
first is zoom and second is bouncing.These two animation can be achieved by affinity transform.Scaling, rotat...
Clear view or image with touch in iOS
Hi Readers,
Paint related apps are usually used to clear content what have been drawn. One can achieve it by using Core Graphics framework provided by iOS.
With touch delegate methods will be called so following code snippet will give prope...
Play video within given frame or in UICollectionViewCell/UITableViewCell
Hi Readers,
Usually we have scenarios for playing videos within the app. MPMoviePlayerController will be used for that. But you can see MPMoviePlayerController deprecated in iOS 9 and later. So we need to put our focus on AVPlayer now. With AV...
How to play music in the background using AVAudioplayer
Hi Readers,
Many times we need to play music even app is in background. It is normal behavior of AVAudioPlayer to play sound when app is in foreground or active state. But to play sound, music or song even in background state can be achieved b...
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 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...
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 ...
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 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 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 ...
Adding Toolbar above keyboard
Hello Readers,
To add a toolbar above the keyboard we may use the following code snippet.
We will create a toolbar with the needed items and set as the input accessory View of the keyboard. In the below code we have added a done button on t...
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...
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...
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.
...
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...
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 set UICollectionView right align?
Hi Readers,
This blog will display the collection view content in Right To Left language such as Hebrew/ Arabic. Generally, you will see the collection view as displayed in the below screenshot.
To set UICollectionView right align first...
How to create marquee effect on imageview in Objc
To create marquee effect first set scroll view either via storyboard or via code
Here in this example I am setting up scroll view via code.
declare these variables
UIScrollView *scrollView;
NSTime...
Share text on whats app in iOS
Opening whatsapp:// URL with one of the following parameters, will open whatapp and perform a custom action like sharing of text:-
1- Add whatsapp in LSApplicationQueriesSchemes to your info.plist
2- Message will be diplayed as M...
UI Objects not visible in storyboard when changing height and width specifications
You may often come to a situation when your UIObject(say UIImageView) is not visible on storyboard.
It may be because you’ve dragged and dropped the UI Object for specification(say Regular Width - Regular Height) other than Any-Any.
&...
How to get Image Filters in Core Image framework
Hi Readers!
Many times we need to check what Core Image filters do we have in iOS framework. Here is a simple code to get all the list of filters with their attributes. This will be easier for you to check and apply any filter on an image.&nbs...
How to launch Apple Maps from iOS app
Hi Readers!
Below is the code to launch the Apple Maps application and display the directions between 2 points on Map.
Example 1: Display directions
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2...
How to play a video file ios
Hello Friends,
Create an object of MPMoviePlayerController:
MPMoviePlayerViewController *moviePlayerController;
NSURL *videoUrl=[NSURL URLWithString:@"String value of your url"];
Initialize the instance of MPmoviePlayerViewControl...
How to display annotation on any Location in MKMapView
If we want to display the annotation point on any coordinates in MKMapView use the following functions-
By using the annotation anyone can easily recognize the location.We can also set the Title here which will show when user click on that...
How to use Flow Layout in UICollectionview
cells in UICollectionview can be of same Size or different sizes, so we use the flow layout. UICollectionViewFlowLayout manage items into a grid with header and footer view for every section.
Here we define the flow layout--
-(void)viewDidL...
How to set placeholder text in uitextview
If we want to set the placehoder text in uitextview then we have to use the delegates methods of textview because there is not an option to set the placeholder directly in xcode.
Here is the methods--
-
(void)viewDidLoad {
[super vi...
Set Dynamic Size of button according to the Title text
if you want to change the size of UIButton according to the title text then use the following function--
-(void)setDynamicSizeOfButton:(UIButton *)button andSize:(CGFloat)Size {
CGSize size = [button.titleLabel.text sizeWithAttributes:
...
How to Show a pdf File from URL in a UIWebview in iOS
when we want to open the pdf file from a URL string then we use the UIWebView. In webview we can directly open the file by loading the url request.use the following function--
-(void)addWebViewOverLay:(UIWebView *)webView {
webView = [[UI...
Seat Selector For iOS
Hi All,
Now days , we start booking seats online so if you also want to implement seat selection functionality than follow these steps .
Download ZSeatSelector from this link https://github.com/richzertuche/ZSeatSelector
Now drag two fil...
Show a route between two coordinates using MKMap view in iOS
In ios when we want to show a route or poly line between two coordinate then we use the following function.
most of time we use this when we want to dislplay the route from current location to destination address.
Here mapView is the property...
Convert NSString to NSDate and vice versa
HI all,
If you want to convert NSString to NSDate ,then you must use NSDateFormatter to convert please follow this code .
NSString to NSDate
In Objective-C :-
NSString *dateString = @"11-11-2015";
NSDateFormatter *dateFormatter = [[...
add touch event to UIView
To provide some action on touch of any view ,UITapGestureRecognizer is used.
Write this code in viewDidLoad
- (void)viewDidLoad {
[super viewDidLoad];
myView.userInteractionEnabled = YES;
UITapGestureRecognizer *singleFingerTap =
...
How to check user current notification setting in objective C
hello friends ,
You can check user's current notification setting by following line of codes.
// this method is deprecated in iOS 8.0
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
i...
Blur Effect on screen in iOS
To add the blur Effect on screen please follow the below steps
Select an image on which you want to add the blur effect.
Add an imageView on screen with the size you want blur effect on screen.
Add the effect with the same size on which yo...
Caputre Screen Shot in IPhone
if you want to capture the screen shot of the screen in swift use the code below. this function will return an image that can be used as background image of a view
The size of the captured image is same as the size of device.
func caputreSc...
date picker in place of keyboard in UITextField
The date picker is used to pick date for textfield. It is placed in textFieldDidBeginEditing (a delegate method of UITextField), so that the keyboard is replaced with date picker as soon as you enter into textfield. updateTextField will set the ...
test if an NSString is empty in Objective C
You can check if( [empName length]==0 || [[empName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) this will return 1 else 0
NSString *empName;
if ([empName length]==0 || [[empName stringByTrimmingCharac...
Check for the iPhone Models
To know On which hardware iOS is ruining like iPhone4 , iPhone5 etc below is the code for that
#import <sys/utsname.h>
-(NSString*) deviceName
{
struct utsname systemInfo;
uname(&systemInfo);
r...