Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
Send a request using Alamofire in swift
Use the alamofire in swift first install the pod file in your project using below steps:
1- open the terminal and run following commands
sudo gem update --system
sudo gem install cocoapods
pod setup
change folder to the current proejct ...
How to use completion handler in swift
The code below will help you in declaration of completion handler and how to call the completion handler in swift.
To declare a completion handler in swift use the line :
typealias completionHander = (sucess: Bool)->Void
//decalrat...
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 The Contact List in iOS
To show the list of contact in iPhone use the code Below:
1- import the ContactsUI framwork in viewController
2- Confrom the ViewController to the CNContactPickerDelegate
3- call the delegate method func contactPicker(picker: CNContactPicke...
Bounds and Frames in iOS
Hi Readers,
This Post is to tell about the BOUND and FRAME in ios.
BOUND:
The bounds property of a view defines the size of the view and its position in the view's own coordinate system. This means that in most cases the origin of...
How to Animate the Table cells
Hi Readers,
To make the tableView cell animate from a particular point to its position, you just have to add the lines below in the willDisplayCell: delegate function of the table view as shown below.
-(void)tableView:(UITableView *)table...
HOW TO CHECK IF AN INTERNET CONNECTION EXISTS ON iOS DEVICE
Hi Readers,
The most simple way to know that the device is connected to the internet is :
NSURL *scriptUrl = [NSURL URLWithString:@"http://apps.wegenerlabs.com/hi.html"];
NSData *data = [NSData dataWithContentsOfURL:scriptUrl];
if (data)
...
MFMessageCompose ViewController in swift
Step1: Import the MessageUI using :- import MessageUI
Step 2: class ViewController: UIViewController, MFMessageComposeViewControllerDelegate
Step 3: when you tap on the button the list of contact will appear and you can choose the contact ...
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...
Create a PIe Chart in iOS
The main use of a pie chart is to show comparison. When items are presented on a pie chart, you can easily see which item is the most popular and which is the least popular.
you can create the pie chart in iOS by using the following methods...
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...
How to use UIActivityViewController for sharing on iphone and ipad
Hello Readers,
In order to share text or links from the application, you may use UIActivityViewController . This is an easy way to share from within the application.
NSString *textToShare = @"text you would like to share"
NSURL ...
NSTimer in IPhone SDK
Here is the code for:
calling a method after a time interval delay.
we use the NSTimer to implement this.
NSTimer *timer= [NSTimer scheduledTimerWithTimeInterval:3.0
target:self
...
Find the country of the user
To find out the country of the user please use the code below:
1- Add the coreLocation Framework to your project and import #import <corelocation corelocation.h="">
2- Set the CLLocationManagerDelegate as UIViewController
@interface...
Why to use tuples if we have Arrays in swift language and How it is different from Structures?
Hi Readers,
Before Moving ahead with the Topic,Lets us Briefly have a overlook what actually a Tuple is:
* In very simple language:
A tuple is a group of zero or more values represented as one value.
For example ("Pen", "50") ...
Search a location in ios SDK
if you want to search a particular location using the google api so you can use this .
Step 1: Get the serverKey From the http://console.developers.google.com/ and write the server key as below.
Step 2: #define kGOOGLE_SERVER_KEY @"dsjfdsuiodfd...
UIAlertController as an action sheet in iOS8 and above.
Now you can use UIAlertController as an actionsheet in iOS 8 and above versions. Here is an example of it:-
UIAlertController * view= [UIAlertController
alertControllerWithTitle:@"Sample"
...
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...
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...
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...
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...
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 ...
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...
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.
...
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 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];
...
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...
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...