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

Add dots to UILabel if text does not fit frame

Hi all, If you want to show dots if text does not fit UILabel frame. then just copy this code. UILabel property "numberOfLines" is 1 by default. Try to set it 0 if you dont know the exact numberOfLines and use sizeToFit method of UILable...

Calculate distance between two point and draw route on map

Hi all, Let take you have two points, Point1 (In Boston) and Point2 (In Atlanta), Now you have to show the route between two points. In below method , you have to pass two param's i.e.. two point of map. - (void)displayRouteFrom:(CLLoca...

Change color of polyline

Hi all, If you want to change the color of a polyline or route on map just change the color in this delegate of map. - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id <MKOverlay>)overlay { MKPolylineRen...

Adding card with braintree

Hi All , These are simple steps to add card to braintree account in iOS. 1.Initialize braintree object with valid client token. BTAPIClient *token = [[BTAPIClient alloc] initWithAuthorization:@"cleintToken received from tree"]; ...

Different Modes Of Date Pickr in iOS

There are 4 Modes of UIDatePicker as- UIDatePickerModeTime-It is used to displays hour, minute, and optionally AM/PM designation.. UIDatePickerModeDate-It is used to displays month, day, and year depending on the local settings for e.g ...

How to make a Round UIView with selected Daimeter programatically in iOS

Create UIView as UIView *myroundView; or watever name suits u... Allocate it itz memory as well as its frame & its diameter as- myroundView = [[UIView alloc]initWithFrame:CGRectMake(40, 18, 15, 15)]; [self setRoundedView:myroundVie...

Merge images to make a single image

It is easy to merge different images to make a single image. It is like pasting images to a canvas and taking picture of that canvas. Below I have explained how to do it. -(UIImage*)combineImages:(NSMutableArray *)images{ CGRect frame =...

Slide menu application in iOS.

Hi Friends, I know there are several applications which are using Slide Menu option. You can find several libraries or classes in Objc to build an app like that. Here is the most easy and customizable class to get it. Its name is SKSlideVie...

Listing the videos stored in gallery

Hello friends, The following code can be used to show the videos stored in gallery: UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePicke...

Change UISearchBar Field Text Color in iOS

You can change UISearchField text color in iOS. Use single line of code to do it. [[UILabel appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor whiteColor]]; Happy Coding!!!

Change UISearchBar appearance in Objective C

If you want to change the appearance of UISearchBar and its related elements then use below code. -(void)changeSearchBarAppearance{ [[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setBackgroundColor:[UIColor whiteCol...

Add image over another image

Using few lines of code we can add one image over another image. It is useful when we need to add a watermark image over an image. -(UIImage *)imageWithWaterMarkImage :(UIImage*)topImage originalImage:(UIImage*)image { CGSize size = imag...

Compare two dates in iOS

To compare two dates we can use the following code : NSComparisonResult result = [mydate1 compare:mydate2]; //where mydate1 and mydate2 are two dates we want to compare. if (result == NSOrderedDescending) { //mydate1 is later than myda...

Detect if an Internet Connection exists in iPhone using (ARC and GCD compatible) class

Hi Readers, Below are steps you need to follow when you are checking if their is an Active Internet connection in an Iphone using (ARC and GCD compatible) class. 1) Add SystemConfiguration framework to the project but dont worry about inclu...

How to change the font of SearchBar's Placeholder and TextField

To change placeholder font add the following code: [[UILabel appearanceWhenContainedIn:[UISearchBar class], nil] setFont:[UIFont fontWithName:@"Helvetica" size:12.0]]; and,to change the font for the SearchBar textField add the following lin...

Changing TextField Placeholder Color

Hello friends, We may change the text field placeholder color using either storyboard or using code. Using Storyboard: Choose the text field and under textfield runtime attributes click on the '+' button and add a key: _placeholderLab...

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

How to create first iOS application in Xcode?

How to create first iOS application in Xcode for iPhone with no programming experience where Ill help even the non-programmer to enjoy coding as an iOS developer. This is an XCode tutorial for beginners so Ill be going through where to downlo...

How to show a overlay view in ios

Sometimes we need to show a overlay view over the main view so that user not able to click on the background view assets like button click. in order to display the overlay view use the following function-- - (void)getOverlayView{ overlay...

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

How to create a UIAlertView in swift

Hello friends , To create UIAlertView in swift -> UIAleartView is deprecated in iOS 9, so you need to use UIAlertController instead . let alertController = UIAlertController(title: test alert, message: this is a test alert, preferredS...

How to change default search bar text and icon

Hello Friends, Changing the default text of search bar: Using storyboard: The search bar has a placeholder property, you may give it any text value as per your requirement. Using code: ObjectofSearchBar.placeholder = @"Your Value"; ...

Get contact name and phone number

Hi all, If you want to get contact name and contact number from your iphone contact list then below two methods can help you to get contact name and contact phone number . Note: In this you will only get those contacts,which contain phone ...

Sorting an array containing mantle model as object

Hi all, To sort an mantle array containing mantle model as object ,You can easily sort by multiple keys by adding more than one to the array. Using custom comparator-methods is possible as well. NSSortDescriptor *sortDescriptor; s...

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

How to change Font size of a UI Segmented Control in IOS?

Simply Use following Code & set the "size" field according to your desired font [[UISegmentedControl appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"STHeitiSC-Medium" size:13.0], UITextA...

Adding Blur effect in swift

Hello friends, To add blur effect in swift you may use the following code: IBAction func blurImage(sender: AnyObject) { // 1 Create an object of UIBlurEffect,you may change the value of style as per your requirement var darkBlur = UIB...

Save and retreive text from text file

Hi all, If you want to save anything in text file or any kind of file than you can follow this code. This code will save text to textfile in your application directory.You can retrieve text from save file later on . NSError *error; NSStrin...

Make HTTP request in swift using ALMOFIRE

Hi all, if you want to make a http request (GET or POST) using almofire. you can follow these steps. We can make http request like GET,POST,DELETE,PUT etc. but we use majorly get and post request. Post request are more secure than get reque...

Using Storyboard Reference

When multiple developers are working on the same project and we have a single storyboard, we might face conflicts in the storyboard file. And the conflicts of storyboard are difficult to resolve. Xcode 7 provides a new feature of storyboard ref...

Chaneg Textview height according to text

Hi All, If you want to change height of textView according to content height than you can follow this code. Use auto layout to set view in story board and make IBOutlet for textview . Assign delegate to textview and dont give height constra...

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

Show flags using Unicode

Hi All, If you want to show flags in using unicode hex coding (U+XXXX) than you can follow this code . UNICODE:- Unicode is a computing industry standard for the consistent encoding, representation, and handling of text expressed in most of...

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

How to get data from dictionary and add them into an array in ios

If you want to get data from dictionary and add them into an array below code will help you, In this blog firstly i have created a NSMutableAarray and after that created a NSArray which contain the value like ram,13 etc then i created a NSMutable...

Create a dictionary which contain an array

To create a dictionary which contain an array below tutorial will help you. In this blog firstly we create a NSArray which contain some value and after that I have displayed all the value and then created a NSMutableDictioary and provide a key t...

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

How to create a UILabel & UIButton programmatically in Swift

hello friends, this is how we can create a UIButton and UILabel in swift. Set a UILabel in swift var label = UILabel(frame: CGRectMake(100, 100, self.view.bounds.size.width, 50)) label.center = self.view.center la...

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

Present UIViewController in swift from storyboard or XIB

Hi All, If you want to present UIViewController in swift from storyboard . For example :- FirstViewController.swift is a viewcontroller in your Storyboard with storyboard Identifier FirstViewController then to present this viewcontroller use t...

How to search parse DB in iOS app

No separate method is provided to do search in Parse document. Following code can be used to search a column . PFQuery *query = [PFUser query]; [query whereKey:@"username" hasPrefix:searchText.lowercaseString]; [query whereKey:@"obj...
1 6 13
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: