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
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...
Warning in my Project
How to remove this Warning ? please help
'cdv_base64EncodedString' is deprecated: Deprecated in Cordova 3.9.2. Use NSData base64EncodedStringWithOptions instead. This will be removed in 4.0.0
Thanks
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...
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...
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...
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 =
...
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...
Delete object from Parse table in iOS.
If you want to delete an object from Parse DB then you have to run a query to fetch that object and then run a loop to delete it. If you already have that object then just call delete method. Here is the complete code.
PFQuery *query = [PFQuer...
Get thumbnail image from a recorded video in iOS
If you want to get thumbnail image from the recorded video in iOS then you can cut a small frame from that video to generate an image. You just need to send video output URL to below method as a parameter. This method willl return you NSData. Lat...
Property List of MPMoviePlayerController for iOS
There are several properties available for MPMoviePlayerController in iOS. We just need to use them to play the movie according to our need.
You can access these properties like this:-
Create property in .h file
@property (strong, n...
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...
How to use NSMutableAttributedString
Hello Friends,
NSMutableAttributedString allows to set different attributes(font size,font color) for different parts of the string.
To use NSMutableString you may use the following code:
//Create an object of NSMutableAttrinbuteString and ass...
To call and send parameters to java Script function from Objective C
To call javascript function write the following lines :
NSString *getStringvalue=[webView stringByEvaluatingJavaScriptFromString:@"getName()];
Where getName() is a JavaScript function which return a String value.
and to send Objective C...
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...
Audio Playing while App is in Background Mode
In order to continue your audio running while the app is in Background mode(like in the case of live Streaming), we just have to add this line in our AppDelegate method application didFinishLaunchingWithOptions:
[[AVAudioSession sharedInstanc...
TableView in Swift
To create a tableView in swift please follow following steps:
Step 1: Add a tableView in viewController.
Step 2: set the dataSource and delegate
Step 3: Create a prototype cell
Step 4: Change the class of prototypecell to "TableView...
How to implement the Auto Layout Contraint through Code
Hi Readers,
This Post is just a brief introduction about How we can implement Autolayout Contraints through coding.
Now,Before moving ahead with the topic let us have a brief about AutoLayout.
WHAT IS AUTOLAYOUT...??
Auto Layout is a ...
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...
Check Wifi Network reachability in Swift
In Swift if you want to check the Wifi connection in your device then use following code.
This is a function which returns Reachability instance (reachability class object) value as a returnvalue for wifi connection availability.
+ (instan...
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...
ios automatically converting dialed number
I am writing code to make calls from the app.I am in India. It works fine for non toll free numbers. But for some number such as 18601231000 for BigBasket it is converting the number as +1(860)1231000 which when dialed comes as wrong number.But f...
Fetch Parse PFUser data in iOS
If you are querying on Parse User class and not getting the user data of custom columns then use below code.
PFQuery *query= [PFUser query];
[query whereKey:@"username" equalTo:[[PFUser currentUser]username]];
[query getFirstObjectIn...
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...
ENABLE_BITCODE in xcode 7
Bitcode refers to an intermediate representation of a compiled program. The installation of iOS, tvOS, and watchOS apps by tailoring app delivery to the capabilities of the users particular device. Apple called this optimization,"app thinning".
...
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...
Hide Status bar in iOS
In iOS apps when we need to hide control center appears in iPhone device on swipe up gesture or forced to hide UIStatusBar then use below code.
Write below lines in your viewDidLoad method.
if ([self respondsToSelector:@selector(setNeedsSta...
Reading large files from NSInputstream is not working in ios
I am trying to read large Image file more than 300KB from NSInputStream. But i'm getting only upto 300KB. Other data are missing. Could you please help me if you know. i'm waiting for your valuable answer. I mentioned my code below : Call this re...
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...
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...