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
Change background color of uibutton using subclass method
Hello all !
Explanation is,
Suppose we want to change the background color of the UIButton when it is selected and when reSelected change it to the default colour.
There are many methods for doing so and one of them I am explaining below :-
...
Change the PlaceHolder colour
As we know that we can't change the place holder color of the Text Fields but sometimes if we need to change it then we can do it by using following code.
UIColor *color = [UIColor grayColor];
self.myTextField.attributedPlaceholder = [[...
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...
Calculate number of days between two dates in iOS
Number of days between two dates
Here is a code given below for calculating the number of days between a specific date and current dat...
How to print the stack trace using symbolic Breakpoint
Hi Readers,
When You find any runtime conflict in your constraints while running the app and you are not able to find the place where the conflict is.
Then, making a symbolic breakpoint and printing the stack trace can be very helpful....
HOW TO MOVE FROM ONE CONTROLLER TO ANOTHER WITHOUT SEGUE?
Hello all !!
Explanation of the topic is :--
Whenever we have to move from one controller to another we usually do it by performing Segue between the two view controllers in the MainStoryboard..
The segue requires an identifier and from wher...
Tabbed Application in iOS
In this blog we are displaying that how we can create a tab bar based application in iOS.
Step 1. Create a new project and select Tabbed Application Template instead of the Single View Based application and click next.
Step 2. Name that app...
Autoplay the Youtube video in UIWebview in iOS
if you are using the UIWebview and want to autoplay the video from url then just add the "autoplay=1" at the end of the url.
Here is the code:
NSString *url=@"https://www.youtube.com/watch?v=vs3sVrm_W4o&autoplay=1";
[se...
How to add a Refresh Control on a tableView
Hi Readers,
To refresh the table whenever you pull down the table, we need to use Refresh Control.
To add a UIRefreshControl on a TableView you just have to add a below code in your viewController.
UIRefreshControl ...
How to add multiple images with animation in UIImageview in iOS
If you want to display the multiple images with animation in UIImageview then use the following code:
Here you can also set the repeat count of the images.
UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.boun...
How to convert from NSSTRING TO NSDATE ?
// date from string
NSString *dateString = [NSString stringWithFormat:@"%@",_model.time]; // model.time is the field in which we are fetching the string.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFo...
How to calculate distance from array of coordinates in iOS
If we want to calculate the distance from the array which contains the coordinates i.e Latitude and Longitude then use the following code-
-(void) getDistanceFromArray {
CLLocationDistance totalKilometers = 0;
for (int i = 0; i < ...
How to use the Autocomplete API with Google Maps SDK on iOS
By Using the following code you can integrate the Google Maps SDK in your iOS project.
First we will write the function which results the array of related nearby places.
-(void) searchLocation:(NSString *)locationName{
GMSAutocomplet...
How to add new .pch file to your Xcode Project?
From Xcode6 and later .pch file is not created automatically. One has to create it manually.
Following are the steps to add/create a pch file in your xcode project:
Create a new file using: cmd+N
• &nbs...
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.
&...
Pass data from one ViewController to another in iOS
I’ve just created second view controller class by extending from the UIViewController class. However, it doesn’t differ from the parent class until we add our own variables and methods. There are a couple of things we have to change:
...
Use vibrancy effect in UITableViewCell like notification center.
1. It is must to import “NoticationCenter” so that we can use “notificationCenterVibrancyEffect”
import NotificationCenter
2. At the time of cell selection do following code in delegate method...
How to remove any section of webpage before load it in UIWebView
If we want to remove any section from webpage like header or footer than use the following code.
In the following code header and footer.footer are the tag identifier of html Class.
We have to use the appropriate tag of the control which we...
Add Suffix To Date
Add Suffix To Date
Here is a very simple example of adding suffix to the date in iOS .With the help of example given below you can easily add a suffix to the date selected by the NS...
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...
Adding Route In GoogleMap
Hi All,
If you want to show path between two points then you have to add the path or route between that two points. Generally route is also a polyline but it is proper path followed by a person or any vehicle to travel from one point to anothe...
How to create UINavigationController Based Application in iOS
The UINavigationBar class provides a control for navigating hierarchical content. It’s a bar, typically displayed at the top of the screen, containing buttons for navigating within a hierarchy of screens. The primary properties are a left (...
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...
Collapsable UITableView header in Swift
To collapse table header in swift ->
1. Make a property of NSMutableSet, name it "collapsedSections", this property will be use to check Collapsed section in the UItableViewCell.
var collapsedSections:NSMutableSet =...
UIAlertViewController with TextFiled in iOS
To Create a alertView with textField in Xcode 7.2 we can Use the the code below to handle the Yes and no action.
and also get the text of the textField. You can show this on a viewController.
UIAlertController * alert= [UIAler...
Sorting an Array ios
Hello Readers,
To sort an array in ios you may use the following code snippet:
// Name of the key on basis of which you want to sort
NSSortDescriptor *dateDescriptor = [NSSortDescriptor
sor...
How to give border color to UIButton in objc and Swift.
To give border color to UIButton :-
1. Take UIButton as property .
2. Give corner radius and corner width to UIButton.
3. Now give border color to UIButton.
For Swift use :-
demoButton.backgroundColor = UIColor.clearColor()
demo...
AppDelegate,UIApplicationDelegate,UIApplication Object,Singleton
UIApplicationDelegate-> UIApplicationDelegate is a protocol which consists some predefine methods. These methods are called by singleton UIApplication object.
UIApplication Object-> UiApplication Object is the object of UIApplication...
Different AppStates in iOS
THESE ARE THE APPSTATES IN IOS
AppState tell that whether the app is running in foreground or background or when the state changes..
In early versions of iOS three states were supported : n...
AppDelegate
AppDelegate-> AppDelegate is a class which inherit from UIAppDelegate and contains basics launching methods of any applications .
It contains many methods but five basic methods are given below.
- (BOOL)application:(UIApplication *...
Get the list of All Available Font in ios
To get the list of all the font that is available in xCode you can use this code.
for (NSString *name in fontnamesArray) {
NSLog(@"Font Family: %@",name);
NSArray *fontFaces = [UIFont fontNamesForFamilyName:name];
...
Xcode Demo
Welcome to Xcode tutorial series.
This is an XCode tutorial for beginners and introduce you to the main parts of the development environment of Xcode. There are 4 major areas: the Navigator, Editor, Debug Area and Utility Area.
The Navigator ...
Two Way Binding in Swift
Hi All,
Two Way Binding :- In two way binding, data flows in both direction, from object to UI and vice-versa. For instance, you can have a UITextField called as nameTF which is binded with an object having property nameValue. So when the obj...
History of Objective-C
History of Objective C
Brad Cox and Tom Love are those famous personalities who invented Objective C in 1980 for their company Step stone. They introduced Smalltalk at ITT corporation's programming technology centre in 1981.
Brad ...
UIAlertController in iOS
For iOS 8 and above Apple have introduced UIAlertController to present action Sheet and alerts.
In order to present alert set preferredStyle to UIAlertControllerStyleAlert and for actionSheet preferredStyle to UIAlertControllerStyleActionShee...
How to stop a video in AVplayer in iOS
For those who are new & trying to use AVplayer in their iphone apps,i would like to share that AVplayer has in built functions for only PLAY & PAUSE as "[self.myAvPlayer play]; & [self.myAvPlayer pause];",which are handy to use,where...
How to Set frame of a Video in Avplayer in iOS
While using AVplayer in iOS sumtimes the video frames are not proportionate to the iphone screen that can led to distortion in UI of your app,therefore to overcome this problem we have to use a simple piece of code..
Go to the function
-(v...
Auto Layout Using Visual Format Language In Swift
Hi All,
You can add auto layout constraints by using Storyboard Interface OR by adding constraints dynamically. There are three ways to add constraint dynamically (as per Apple Inc.)
Visual Format Language is one of the way is used to a...
Auto Layout Using NSLayoutConstraint In Swift
Hi All,
You can add auto layout constraints by using Storyboard Interface OR by adding constraints dynamically. There are three ways to add constraint dynamically (as per Apple Inc.)
NSLayoutConstraint is one of the way is used to add autol...
Adding auto layout constraint dynamically in swift
Hi All,
You can add auto layout constraints by using Storyboard Interface OR by adding constraints dynamically. There are three ways to add constraint dynamically (as per Apple Inc.)
Layout Anchor is one of the way is used to add autolayout...
NSTimer In Swift
Hi all,
You can use the NSTimer class to create timer objects or, more simply, timers. A timer can wait and call a method or selector after defined period of time. for example :- if you want show a seconds clock and stop when it completed 60 s...
Zoom mapview to show all annotaions
Hi all,
If you are adding multiple annotation in your amp and you want to show all annotations initially. then just call this method after adding all annotation to your mapview.
There are some globally declare variable such as :-
#defin...
Display Splash Screen for longer Time in iOS
Splash Screen is the first screen which appear when we launch an application and disappear when the main screen get loaded. It appear for a few second to show that our app is fast and responsive .
In order to display your splash screen more t...
Error Handling in Swift 2
SWIFT
Swift is a very powerful and simple programming language which is used for creating the iOS applications.Swift is a language which is designed to work with Apple's Cococa and Objective-C. The advantage of this language is that it is one...
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...
Deleting Cells of tableview ios
Hello friends,
To delete a cell at a particular indexpath you may use the following code:
-(void)removeItemAtIndexPath:(NSIndexPath *)indexPath{
[(name of table) beginUpdates];
// I am assuming that you're just using a plain NSMut...