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
Slice an Image into Tiles and Store in an Array Using Swift iOS App
This is a small sample of how we can split an image into multiple pieces/tiles and store these small pieces into an array and further we will show, how these pieces are rearranged to form an image.
So let start with s...
Convert HTML Content into Image to Show WebView in ObjectiveC iOS App
In our application sometimes there is a need to show webView content as a preview or as a thumbnail and for that simplest solution is to convert html content into image which can then easily be used in our app.
So ...
Customize UITabbarController by Collection View for iOS App in iPhone Device
As we have noticed that iPhone/iPad tab-bar display maximum five tabs and if we have more than 5 tabs then only 4 icons are visible with 5th one displaying more option. In case we need to display more than 5 tabs without more icon we need to cust...
How to Fetch data from Plist in Swift?
Hi
Property List or plist files provide a convenient way to store and access our data. Data can be stored in the form of array as well as Dictionary. It supports various primitive types such as boolean, data, date, number, and string.
...
Send Text Message in Swift
Hi,
Here we’ll learn how to send messages programatically in Swift. With the use of provided MessageUI framework we will implement message functionality in our app. This framework has MFMessageComposeViewController class which prov...
Send Email in Swift
Hi,
Here I’m exploring how to send mails programatically in Swift. Apple has provided MessageUI framework to implement mail functionality in your app. This framework has MFMailComposeViewController class which provides an inter...
Convert UIColor to Hexa Color Code
Hi,
If you want to get the HexaDecimal String code for any color then below code will surely help you to come out with the hexa color string.
Here are the steps to get hexa code string for any color.
1- Declare the va...
Function Returning Function in Swift
Hi,
As we all know that Swift comes with new and variety of enhancements over objective C. Returning a function as a return type of a function is also one of them.
Here we are defining two functions which are accepting Int kind of...
Generic Function in Swift
Hi,
Swift has a powerful feature of writing generic function as in Java which was missing in objective C.
It makes our code flexible and reusable for various types, meaning it can work with any data type. For similar logics and prob...
Add InputAccessoryView in Swift for UITextField and UITextView
Hi,
Sometimes we need to show our custom accessory view when UITextField/UITextView is in editing mode or being edited. We can use inputAccessoryView property to assign a view just above the system keyboard.
Input accessory view is ...
Control Flow & Conditional Statement Video Example for Beginner - Swift
Swift provides various Control flow and Conditional Statements. Although these are similar to Objective C but with improved enhancements and usability. These statements can be used to check, iterate over various conditions and values.
In this Sw...
PopOver from storyboard
Hi,
Presenting popover from storyboard is easy and developer friendly. One can handle Popover from storyboard itself with a little code handling.
Following are the steps to present Popover from storyboard.
1- Draw an action seg...
Defer in Swift
Hi,
Swift has introduced a new keyword called 'defer'. Based on its meaning ‘defer’ puts off an action or event to a later time. It runs when the execution is about to leave the code block. You can use ‘defe...
Draw Line And Circle with Animation
CoreAnimation has provided various animation APIs that can be used to accomplish the animation needs. Using UIBeizierPath and CoreAnimation APIs here I’m drawing a line and a circle using CAShapeLayer.
//Below is the function to d...
Bounce effect on View
iOS has integrated full physics engine to UIKit. Which not only integrate physics-related capabilities but adds smooth and fascinating animations by using underlying iOS Physics engine and provided dynamic items what we send in API. One can use t...
Providing Extra padding in UITextField
UITextField is an editable area where one can use to get input from user using keyboard.
We often come to a situation where extra padding is required from the left or right depending on requirement. Padding is already provided by UITextField...
Copy Paste in Swift
Apple provides the UIPasteboard class which enables the data to be shared within the app and with another app. To share data we can use pasteboards.
Here is the code snippet depicting how copy and Paste functionality can be achieved in...
Animating images in ImageView
ImageView can be used for animation with a set of multiple images using various properties offered by apple.
Here are I’m going to tell you steps to animate images in ImageView:
1- Initialise an array of UIIm...
NetworkReachability Listener in Alamofire
Alamofire provides a method to check network status reachable on WWAN, Ethernet and wifi. The NetworkReachabilityManager class provided by Alamofire listens whenever there is a change in network.
It can be used to determine background informat...
No Selection in interface builder
With Xcode4.0 and onward(including XCode7.x) we occasionally come across an issue in interface builder which happens while working.
The Attribute inspector in Interface builder says “No Selection” although you’ve object/ele...
Creating SubDirectory using XCAssets
Sometimes we need to be more generic about naming convention of images. We may need same name of assets(images) for various views.
Xcode doesn’t allow us to keep the files with same name and can throw error or change the asset name by it...
Adding Properties to Attribute Inspector in Swift
Accessing properties via interface builder is quite easy and more developer friendly.
Here I’m guiding you how to to add new/custom properties to interface builder.
1- Subclass any UIObject, we are considering here UIButton ...
Function inside a function
Functions are small modules or chunk of code. Swift’s function syntax is so flexible that it allows to write a function inside a function.
Here is a syntax:
func firstFunction(arguments) -> returnType{
func secondFunction(arg...
TextToSpeech API provided by Apple
Apple has provided a powerful api to play audio from text and here are the steps to achieve:
1- Import AVFoundation framework
2- Initialise AVSpeechSynthesizer(as below)
let synthesizer = AVSpeechSynthesizer()
...
How to crop the video from URL in objective-C
If we record the video from our app and need to crop that video in the square shape on any other specific frame then use the following code-
In this code, we need the URL of the video that can be local URL because when we record any video it i...
How to check metadata of an audio file in iOS
Hi Readers,
The below code snippet will give you the meta data of an audio file. You need to add an audio file in Resource Folder. Once that is done use the below code. Let us also understand the code.
- (void)viewDidLoad {
...
How to use NSAttributedString in UITextView?
We can use attributed string with textView by following steps -
1. Make a IBOutlet of your textView
for eg -
@property (weak, nonatomic) IBOutlet UITextView *textView;
2. Now go to storyboard and select your textVi...
Side MenuBar in iOS
Side MenuBar or menu list is used to provide a list to the user so that user can easily move to those pages according to the need. Here is an example of including menubar in the application with the help of a superclass REFrostedViewCot...
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...
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...
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 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...
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...
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...
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.
&...
Fetch the user detail from facebook in iOS 9.0
To fetcht the user detail from facebook like name,first_name,last_name,middle_name,gender etc use the code below :
func fetchUserDetails(useid: String,accessToken:String)
{
let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest...
login to facebook in ios 9.0
to login using facebook in iPhone sdk please use the code below.
install the pods for facebook using
pod "FBSDKCoreKit";
pod "FBSDKLoginKit";
pod "FBSDKShareKit";
pod "FBSDKMessengerShareKit"
import FBSDKLoginKit
...
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...
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...
how to create islamic calendar (hijri calendar) using iOS sdks
Following code will return the today's date in islamic calendar
NSCalendar *hijriCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSIslamicCivilCalendar];
NSDateComponents *hijriComponents = [hijriCalendar components:NSDayCal...
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...
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...
last online status using xmpp and ios sdk
If you are using xmpp server for live chat messaging and want to know how to get the last online status of your friend. Then use the following method and you will get the dictionary in xmpp delegates method.
-(void)getlasttimeActivity:(NSS...
Message posting in GooglePlus IOS sdk
If you integrating Google plus in your IOS app and want to post some message you can use share dialog. To post message first create an object of GPPShareBuilder then you can set the text or url in this object like below example.
id<GPPShare...