Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Applying constraints using code in ios

We can apply constraints with the help of coding also. Suppose we have a button and we have to give constraints to it so below coding can help us to do so. Lets make a custom button first.   UIButton *firstButton; firstBut...

Storage Classes

Storage classes are used to check the visibility and scope of the variables. There are 5 types of storage classes. auto storage class->   the auto storage class is a default storage class and it  is for all local variables...

Table View

  Table view is one of the most frequent iOS app UI element. In iOS many of the apps utilize tableview to exhibit a list of data. Special features of tableView include headers, footers, rows, and section. It provides a list of options fur...

How To transfer data from one viewcontroller to another viewcontroller in Tabbar?

If we have to transfer data from one view controller to another then we generally use prepare for segue method but in case of Tabbar do not need to use that method, we can directly send data in following way:   For Example: suppose we ...

Concept of protocols in Objective-C

Protocols are another important feature provided by Objective-C language. Basically protocols are used for a particular situation according to the need of a program. Within protocol methods will be declared which are expected to be used for a par...

iCloud

Apple iCloud With the help of cloud computing technology Apple introduces iCloud storage for Apple devices. It's an online storage space given by apple so that you can save any data or access it. iCloud, is designed to work seamlessly with...

New Features in iPhone and iPad

  Night Shift iOS 9.3 has introduced night shift feature for iPhones, which automatically tints our screen to warmer colors(less blue light) at nighttime, so that we don’t have to change the setting by our own for nighttime(like ...

How to change size of UITEXTVIEW according to its text ?

To change the size of a UITextView to its contents i.e as the content of the UITextView increases the size of the textview will also increase. We can implement this by applying the following code :- - (void)textViewDidChange:(UITextView *)t...

Different functionality related to NavigationBar .

Here are listed some of the functionalities that can be implemented on navigationBar:- The below code will Hide the back button from NavigationBar :- self.navigationItem.hidesBackButton = YES; Thie below code will Set background image ...

Collection View

Collection view is used to display multiple data simultaneously on view controller.Data can be of any type for example collection of text or images which can be display on controller with the help of collection view.   With the help of...

Show date picker along with done button when selecting UITextField

If we want that when we tap on a UITextField then date picker should show, so we can use following code- [yourTextFieldOutlet setInputView:_datePicker];// _datePicker is the DatePicker type property Here we want to add done button on a D...

How to Drag and Drop a View from one Position to Another

To add a Drag and Drop functionality in your Application You just have to append the below Code in your app.   //This function is called when the user touches any object -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)eve...

Left padding to the TextField

Whenever we use TextField then bydefault we don't get front space. Sometimes we want that our text should start after some gap so in that case we can use padding. In padding we can give space according to our need. There are two types of padd...

display data in two columns in collection view

We can display data in two columns in a collection view. In below code we are dividing the width of the cell into two parts of the collection view.   - (CGSize)collectionView:(UICollectionView *)collectionView layo...

NSUserDefaults

NSUserDefaults is used to save the data until the app is installed. When data to NSUserDefaults is written by you then it will automatically gets loaded when your app runs so that you can read it back again. In NSUserDefaults we use key to sav...

How to fetch meta data of an image in iOS

Metadata can be described as data about data here the metadata of an image we will fetch by using code in IOS9 . Metadata of an image includes resolution,gps location,creation date,modification date etc. here we will discuss a very simple way to ...

How to move UITextField when keyboard shows ?

When we are entering text in a textField and that textField is at bottom of the screen then we need that the textField should appear above the keyboard and the keyboard should not hide the textField.. For that we need to set the height of keyboar...

Stack View

Stack view is a good option to give less number of constraints to the storyboard items. If we are using stack view then we don’t need to give constraints to each label or button or any object, we can directly place labels or buttons or anyt...

Size Class and Auto Layout

Size Class is used when we need to have different constraints for different screen sizes or orientations. The following table shows how the size classes apply to the different devices and orientations:   Verticle size C...

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...

UiSplitView Controller in Swift

To Create a SplitViewController in swift follow the steps:- 1- Create a new Project. 2- Add a splitViewController. 3- Create a cocoaTouch Class inherits from UIViewController named as DetailViewController 4- Create another CoCoatouchC...

How to add and access TextField in UIAlertController ?

The following code will show the Alert with textField :- UIAlertController *alert=[UIAlertController alertControllerWithTitle:@"Alert Title" message:nil preferredStyle:UIAlertControllerStyleAlert]; // to add textField [aler...

Show a pdf file in ios WebView in swift

Hi to load a swift file in webView in ios :- 1- Add a WebView in your viewController 2- Create an IBOutlet for this. 3- set the delegate fro webView. 4- if you want to load the pdf from server or from an url use the function loadFromU...

How to add Gradient effect to UIButton ?

Hello all ! For adding Gradient effect to the UIButton we can implement the following code :- CAGradientLayer *gradientLayer = [CAGradientLayer layer]; gradientLayer.frame = _customButton.layer.bounds; // _customButton is the outlet ...

How to give bottom border to your textField

By using below code you can give bottom border to your text fields -(void)giveBottomBorderToTheTextField:(UITextField *)textField{ CALayer *border = [CALayer layer]; CGFloat borderWidth = 2; border.borderColor = [UIColor...

Record a sound in iOS

To record the sound in ios we can use the code below:- To record the sound first set the delegate of AVAudioRecorder in AudioRecorderViewController.h File like #import "AudioRecorderViewController.h" @interface AudioRecorderViewControl...

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...

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...

Blend Image in IOS

if you want add the custom frame on image like a border then 1- Add the GPU image Third party library to your project . 2- Use the image with imagename that you want to use as border image of originanl Image. 3- Framed image will the out...

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 shuffle an array

Hi all, Shuffling an array means randomly re-arranging the content of an array .Shuffling algorithm can be used in many places now days like in card games, music player , media player etc. Shuffling of an array can be done in two ways. ...

Tic-Tac-Toe

Hi all, Tic-Tac-Toe is simple game in which you will try to mark your sign in three blocks to make a row , column or diagonal.   RULES FOR TIC-TAC-TOE 1. The game is played on a grid that's 3 squares by 3 squares. 2. You a...

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 get time intervals in hours between start time and end time in objective C

If we want to get the time intervals between the start time and end time then use the following code- it will return the array of hours according to the start time and end time. + (NSMutableArray *)getTimeIntervals:(NSString *)startTime a...

Change the Flash mode of camera in ios

To set the camera flash on or off in ios  Use the code below: -(void)setFlashMode:(AVCaptureFlashMode)flashMode forDevice:(AVCaptureDevice *)device { if ( device.hasFlash && [device isFlashModeSupported:flashMode] ) { ...

Image is Blurred after cropped from a view

if you are going to take a snapShot of  a view in ios and resultant image is blurred please change your code to following.   CGRect rect = [ScreenShotView bounds]; UIGraphicsBeginImageContext(rect.size); Please change thi...

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...

Take the ScreenShot of View with Tabbar & NavigationBar

To Take the screen shot Of a view with navigation & tabbar You can use this code: -(UIImage *)getImageWithNavigationBarInIOS { CALayer *layer = [[UIApplication sharedApplication] keyWindow].layer; CGFloat scale = [UIScre...

A simple function returning UIColor from HexaColor String in swift

Here are step-by-step guide to obtain UIColor: 1- Firstly you need to do is to remove all spaces and new line character sets from the string and then covert the string to UPPER Case example AABBCC. var cString:String = hexColorString.stri...

Parsing JSON objects using Mantle framework in Objective C

Hi Readers, Mantle is latest and reliable framework which we can use while parsing JSON objects coming from server end. We can do this by simply initialize a class of type MTLModel. We can understand framework working with following example...

AVAudioPlayer implementation in Swift

An easy to implement simple swift class working on AVAudioPlayer depicting various features like play, pause and stop.   // creating single instance of class static let sharedInstance = MyAudioPlayer() var myAudi...

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: ...

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...

Fetching Latitude and Longitude On Basis Of Address

Hello Friends, In order to fetch the latitude and longitude of a location based on its address,you may use the following code:   double latitude = 0; double longitude = 0; Use the google api along with your address NSStr...
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: