Latest Post

Thursday 10 October 2019

J. S. Rathore

Redmi 8 in only 7,999 ���� - Redmi 8 User Review

Redmi 8 in only 7,999 🔥🔥 - Redmi 8 User Review & Battery 5000 MaH, Stora...
#Redmi8 #redmi8 #redmi8launch #redmi8price #redmiflipkart #flipkart #flipkartredmi #RedmiPhone #redmibest #redmi8review

Read More

Tuesday 10 March 2015

Jogendra Singh

SOAP webservice calling in iOS with xml parsing

Here we are learning , How to call SOAP webservice in iOS with XML parsing " -

In this tutorial , we will use a third party class for XML parsing that is "XMLReader" 
         NSString *soapMessage = [NSString stringWithFormat:
                             "<newslist xmlns=\"\">\n"
                             "%@\n"  "</newslist>\n"  "
\n"   "\n",[userDefaults valueForKey:@"languageId" ];  // This XML is not showing proper here show visit on  XML String Type   
Here XML is not showing properly show visit on this url XML String Type

      //newslist = It my webservice name that I am going to call and this XML is showing in your browser if you will call your webservice URL
//pi  = Its variable , In this I am sending data on server of my language id

 NSString *soapAction = [NSString stringWithFormat:@"",@"newslist"]; // Here your webservice name that you wants to call 
        NSURL *url = [NSURL URLWithString: @"Enter Here your webservice url" ];
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
            [request setHTTPMethod:@"POST"];
            NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[soapMessage length]];
            [request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
            [request addValue: soapAction forHTTPHeaderField:@"SOAPAction"];
            [request addValue: msgLength forHTTPHeaderField:@"Content-Length"];
            [request setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

            NSURLResponse* response;
            NSError* error;
            NSData* result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
            NSString *  rsltStr = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];
            NSError *parseError = nil;
            NSDictionary *xmlDictionary = [XMLReader dictionaryForXMLString:rsltStr error:&parseError];  // In this I have used XMLReader file

        //you can download XMLReader file her using this like XMLReader FILE DOWNLOAD 

Here in xmlDictionary you will get result from server with xml parsed.

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 

Read More

Friday 13 February 2015

Jogendra Singh

iOS best interview question Part 1

Here I am providing you best iPhone  & iPad interview question that asking too much in interview.
All question are best and so imported for us

I am providing you question if have any mistake then suggest me I will update these.

  1. Difference Between Integer and NSInteger ?

    Answer : -  
                    You usually want to use NSInteger when you don't know what kind of processor architecture your code might run on, so you may for some reason want the largest possible  int type, which on 32 bit systems is just an int, while on a 64-bit system it's a long.

I'd stick with using NSInteger instead of int/long unless you specifically require them.

NSInteger/NSUInteger are defined as *dynamic typedef*s to one of these types, and they are defined like this:

Example : - 
typedef long NSInteger;
typedef unsigned long NSUInteger;
typedef int NSInteger;
typedef unsigned int NSUInteger;
    Answer source is : - Use NSInteger vs. int

   Qusetion 2 .   Difference between strong and retain ?

    Answer : -
                      Its entirely semantic (afaik) to the way ARC and non-ARC projects work. Apple would prefer everyone use ARC and is pushing in that direction.

In a non-ARC project "strong" will act as "retain". In an ARC project "retain" might work if clang doesn't flag an error (i dont use ARC), but theres a subtlety in the description.

Retain says - Im holding on to this object, until Im ready to release it, strong says (hey ARC treat this as a retained object and insert some generated code in my dealloc method to be released when the autorelease pool drains).

strong is a new feature in iOS 5 Automatic Reference Counting (ARC) which behave the same as retain in iOS 4

Answer Reference : - Whats the difference between strong and retain 


 Question 3 : - Difference between frame and bounds ?

  Answer : -
                    The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).

The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.

So, imagine a view that has a size of 100x100 (width x height) positioned at 25,25 (x,y) of its superview. The following code prints out this view's bounds and frame:
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"bounds.origin.x: %f", label.bounds.origin.x);
    NSLog(@"bounds.origin.y: %f", label.bounds.origin.y);
    NSLog(@"bounds.size.width: %f", label.bounds.size.width);
    NSLog(@"bounds.size.height: %f", label.bounds.size.height);
    NSLog(@"frame.origin.x: %f", label.frame.origin.x);
    NSLog(@"frame.origin.y: %f", label.frame.origin.y);
    NSLog(@"frame.size.width: %f", label.frame.size.width);
    NSLog(@"frame.size.height: %f", label.frame.size.height);

  And the output of this code is: 
bounds.origin.x: 0
bounds.origin.y: 0
bounds.size.width: 100
bounds.size.height: 100
frame.origin.x: 25
frame.origin.y: 25
frame.size.width: 100
frame.size.height: 100

So, we can see that in both cases, the width and the height of the view is the same regardless of whether we are looking at the bounds or frame. What is different is the x,y positioning of the view. In the case of the bounds, the x and y coordinates are at 0,0 as these coordinates are relative to the view itself. However, the frame x and y coordinates are relative to the position of the view within the parent view (which earlier we said was at 25,25).

Answer Source : -   difference between the frame and the bounds?

Question 4 : - Difference between category and protocol ? 

Answer : -
                A protocol is the same thing as an interface in Java: it's essentially a contract that says, "Any class that implements this protocol will also implement these methods."

A category, on the other hand, just binds methods to a class. For example, in Cocoa, I can create a category for NSObject that will allow me to add methods to the NSObject class (and, of course, all subclasses), even though I don't really have access to NSObject.

To summarize: a protocol specifies what methods a class will implement; a category adds methods to an existing class.

The proper use of each, then, should be clear: Use protocols to declare a set of methods that a class must implement, and use categories to add methods to an existing class.

Answer Source : -   Protocol versus Category

       Question 5 : - Difference between [self method] or performSelector@selector(method)? 

 Answer : -
                Basically performSelector allows you to dynamically determine which selector to call a selector on the given object. In other words the selector need not be determined before runtime.

Thus even though these are equivalent:

[anObject aMethod]; 
[anObject performSelector:@selector(aMethod)];
  The second form allows you to do this:

SEL aSelector = findTheAppropriateSelectorForTheCurrentSituation();
[anObject performSelector: aSelector];
 Answer Source : -   Using -performSelector: vs. just calling the method

     Question 6 : - Difference between synchronous and asynchronous in objective c

Answer : - 

            You should always use asynchronous loading of network requests.

Asynchronous never block the main thread waiting for a network response.

Asynchronous can be either synchronous on a separate thread, or scheduled in the run loop of any thread.

Synchronous blocks main thread until they complete request.

 Answer Source : -   what is synchronous and asynchronous in iphone and iPad?

 Question 7 : - Difference between  GET and POST in ios ?

 Answer : - 

               POST METHOD: The POST method generates a FORM collection, which is sent as a HTTP request body. All the values typed in the form will be stored in the FORM collection.

              GET METHOD: The GET method sends information by appending it to the URL (with a question mark) and stored as A Querystring collection. The Querystring collection is passed to the server as name/value pair. The length of the URL should be less than 255 characters.

 Answer Source : -   Difference between Post & Get method

 Question 8 : - What is dequeuereusablecellwithidentifier for UITableView iOS ?

Answer : - 
                 dequeueReusableCellWithIdentifier: only returns a cell if it has been marked as ready for reuse. This is why in almost every cellForRowAtIndexPath: method you will see something like

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (nil == cell) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
return cell;
        In effect, enough rows will be allocated to fill the visible part of the tableview (plus one or two more). As cells scroll off screen, they are removed from the table and marked as ready for reuse. As the queue of "available cells" grows, your line that asks for a dequeued cell will start obtaining a cell to use, at which point you will not have to allocate anymore.

 Answer Source : -   UITableView dequeueReusableCellWithIdentifier Theory

 Question 9 : - What is Protocol in Objective C ?

Answer : - 
                In Objective-C, a particular class only has one parent, and its parent has one parent, and so on right up to the root object (NSObject). But what if your class needs to call methods on objects outside of its parent tree? A protocol is one way Objective-C solves this problem.

A protocol is a list of method declarations. If your class adopts the protocol, then you have to implement those methods in your class.

In Objective-C 2.0 and later, some protocol methods can be marked as optional. This means you don't have to implement those, but you still have to implement all of the required methods. When you do, your class is said to conform to the protocol.

Protocols are used quite a bit in iPhone development. For instance, a UITableView requires a data source and a delegate object; these must conform to the UITableViewDataSource and UITableViewDelegate protocols.

To adopt a protocol, add it to your class header file:

 @interface FavoritesViewController : UIViewController  

The protocol names appear after the class declaration, inside angled brackets. When adopting more than one protocol, list them in a comma-separated list.

Then in your implementation (.m) file, implement all of the required methods for each protocol. (For Cocoa classes, consult the documentation to see which methods are required and which are optional.)

 Answer Source : -   Objective-C: Protocols

 Question 10 : - What is notification center in iOS ?

Answer : - 
                Notifications are an incredibly useful way to send messages (and data) between objects that otherwise don't know about each other. Think of it like a radio station broadcasting messages: the station (sender) broadcasts the message, and listeners can choose to listen in and receive some (or all) of the broadcast messages.

For example, you might have a network reachability check in your app delegate, and post notifications whenever the reachability changes. Other objects would listen for that notification and react accordingly when the network goes up or down.

Some Cocoa frameworks send notifications when certain events happen. In iOS 4.0 and up, the application sends notifications when an app is about to move the background... and when it returns from the background. Your app's objects and controllers can listen for these notifications and stop actions (or save data) when the app is about to quit, and resume when it becomes active again.

 Answer Source : -   Notifications

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 

Read More

Wednesday 28 January 2015

Jogendra Singh

Currency format in output in swift language

I'm looking for a way to format a string into currency using the UITextField  in language swift for iOS 8
Using NSNumberFormatter to format currency in output swift language

For example, i'd like to have the number "123456" converted into "$1,234.45" Or if I have a number under 1$, I would like it to look like this: "12" -> "$0.12"

I use this code. This work for me
1)  Add UITextField Delegate to header file
2) Add this code  

  func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {

        if textField.tag == 100 && phoneNumberValidation(string) || string == "" && phoneNumberValidation(string)
            var cleanArray = textField.text.componentsSeparatedByCharactersInSet(NSCharacterSet.decimalDigitCharacterSet().invertedSet) as NSArray
            var cleanCentString  = cleanArray.componentsJoinedByString("")
            var centAmount:NSInteger! =  cleanCentString.toInt()
            if countElements(string) > 0
                if centAmount == nil
                    centAmount = 0
                centAmount = centAmount * 10 + string.toInt()!
                centAmount = centAmount / 10
            var floatValue = Double(centAmount) / 100
            var amount = NSNumber(double:  floatValue )
            var _currencyFormatter = NSNumberFormatter()
            _currencyFormatter.numberStyle = .CurrencyStyle
            _currencyFormatter.currencyCode = "USD"
            _currencyFormatter.negativeFormat = "-¤#,##0.00"
            textField.text = _currencyFormatter.stringFromNumber(amount)
        if textField.tag != 100 {
            return true
        return false
    func phoneNumberValidation(value: String) -> Bool {
        var charcter  = NSCharacterSet(charactersInString: "0123456789").invertedSet
        var filtered:NSString!
        var inputString:NSArray = value.componentsSeparatedByCharactersInSet(charcter)
        filtered = inputString.componentsJoinedByString("")
        return  value == filtered

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 
Read More

Thursday 22 January 2015

Jogendra Singh

In iOS form Phone number validation in swift language

Simple phone number validation in swift ios 8 , Using this function  you can easily  check phone number . Also have some example for this using NSPredicate etc

you can see lots of method for number validation. But I made this sort method

    func phoneNumberValidation(value: String) -> Bool {
        var charcter  = NSCharacterSet(charactersInString: "0123456789").invertedSet
        var filtered:NSString!
        var inputString:NSArray = value.componentsSeparatedByCharactersInSet(charcter)
        filtered = inputString.componentsJoinedByString("")
        return  value == filtered

How to use this validation function in code

if    self.phoneNumberValidation(contactNumTextF.text) == false  {
            let alert = UIAlertView()
            alert.title = "Message"
            alert.message = "Enter Valid Contact Number"
            alert.delegate = self
}else {
            // Number valid

You can also check this validation in Objective C Language  simple phone number validation in IPhone sdk Objective C

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 
Read More

Friday 9 January 2015

Jogendra Singh

UITextField move up when keyboard appears in Swift

UITextField move up when keyboard appears in Swift   :  In swift language have minor change other thing have same - 

Moving view on click of UITexField in swift language

Some textfield hide behind keyboard so how can we move view on textfield editing . So we can work on this ..

Here I have make a function for this , in this you can pass want view move then pass "true" and with your movement height

    func textFieldDidBeginEditing(textField: UITextField) {
            animateViewMoving(true, moveValue: 100)
    func textFieldDidEndEditing(textField: UITextField) {
            animateViewMoving(false, moveValue: 100)
    func animateViewMoving (up:Bool, moveValue :CGFloat){
        var movementDuration:NSTimeInterval = 0.3
        var movement:CGFloat = ( up ? -moveValue : moveValue)
        UIView.beginAnimations( "animateView", context: nil)
        UIView.setAnimationDuration(movementDuration )
        self.view.frame = CGRectOffset(self.view.frame, 0,  movement)

If you want do this same thing in objective-C then visit on this post Moving UIView up when UITextField is selected

Try this it will work fine , I have tested this ..

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 
Read More

Saturday 6 December 2014

Jogendra Singh

UITableview with UISearchBar in swift Language

Create UISearchBar with UITableView in swift language ( iOS8 ). 

In this tutorials we are going to learn how to work UISearchBar with UITableView in swift language .
        UISearchBar Class implements a simple a text field for searches . UISearchBar object does not perform direct we need to user UISearchBarDelegate for this and implement the action when text entered and button clicked.

First Need to create UITableView in swift  : -  How to create / make a simple tableview in iOS8 and swift

Now need to implement UISearchBar in this

   Create global objects  : -

    @IBOutlet var tableView:UITableView!   // This is for your tableview
    @IBOutlet var searchBarObj:UISearchBar!  // It's for your search bar object 
    var is_searching:Bool!   // It's flag for searching  
    var dataArray:NSMutableArray!  // Its data array for UITableview 
    var searchingDataArray:NSMutableArray! // Its data searching array that need for search result show 

Add Delegate of UITableView and UISearchbar

class ViewController: UIViewController ,UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate

Now initialise all array and search flag

    override func viewDidLoad() {
        // Do any additional setup after loading the view, typically from a nib.
        is_searching = false
        dataArray = ["Apple", "Samsung", "iPHone", "iPad", "Macbook", "iMac" , "Mac Mini"]
        searchingDataArray = []
        self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")

Now we need to minor change in UITableViewDataSource functions

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
        if is_searching == true{
            return searchingDataArray.count
            return dataArray.count  //Currently Giving default Value
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
        var cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell
        if is_searching == true{
            cell.textLabel.text = searchingDataArray[indexPath.row] as NSString
            cell.textLabel.text = dataArray[indexPath.row] as NSString
        return cell;

Hows show in simulator now : -

Now need to implement UISearchBar Delegate function

    func searchBar(searchBar: UISearchBar, textDidChange searchText: String){
        if searchBar.text.isEmpty{
            is_searching = false
        } else {
            println(" search text %@ ",searchBar.text as NSString)
            is_searching = true
            for var index = 0; index < dataArray.count; index++
                var currentString = dataArray.objectAtIndex(index) as String
                if currentString.lowercaseString.rangeOfString(searchText.lowercaseString)  != nil {

After searching we can result showing according to our search 

Using this delegate function we can search text using UISearchBar   in UITableView

Download Sample Project from here : - UITableView with SearchBar xCode Project

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 
Read More

Monday 24 November 2014

Jogendra Singh

UISwitch example in swift ios8

How to make UISwitch button in swift language ?

   UISwitch button is return a boolean value like : - true , false , yes , no etc.  In this tutorial we're going to learn example of UISwitch button in swift language, 

Open Object and create new project for UISwitch button .  name of project is "UISwitchExampleSwift" and select language is SWIFT.

Now go in Main.storyboard and drag and drop UISwitch button and One UILabel for showing current state of UISwitch button . 

Now Make object of both UISwitch button and UILabel or also make action of UISwitch Like this :- 

           var switchBtnObj : UISwitch!

 var stateLabelObj : UILabel

and Action of UISwitch button :-

 @IBAction func switchBtnClicked   (switchBtn : UISwitch ){

Connect both of in Storyboard like this :-

Now need to check in Action using if condition like this :- 

    @IBAction func switchBtnClicked   (switchBtn : UISwitch ){
        if switchBtn.on{
            stateLabelObj.text = "Switch btn is on now"
            stateLabelObj.text = "Switch btn is off now"

And change in display :-   If button is off 

Check if Button is On

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 

Read More

Saturday 22 November 2014

Jogendra Singh

Image Resize in swift ios8

How  to resize an image?

In this tutorials We are going to learn "How can resize UIImage in swift language".  Without resize image we can get full image in our view  

First I am showing image that in original size 

If we check this image size than we see image size is "1366 × 768" .
We're not able to show full image in our iPhone screen.

Now Need to check How looks this iPhone without resize 

Setting image in backgroud of UIView

        self.view.backgroundColor = UIColor(patternImage:UIImage(named: "bg Image.jpg")!)

After doing this setup, we see in simulator this type .

In this image we can see image's only few part is showing., so we need to resize image 

Resizing UIImage in swift 

I have made function that can we use for resize image, In that we need to pass original image and size that we need . 

    func imageResize (imageObj:UIImage, sizeChange:CGSize)-> UIImage{
         let hasAlpha = false
        let scale: CGFloat = 0.0 // Automatically use scale factor of main screen
        UIGraphicsBeginImageContextWithOptions(sizeChange, !hasAlpha, scale)
        imageObj.drawInRect(CGRect(origin: CGPointZero, size: sizeChange))
        let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
        return scaledImage

How to call this function  : - 

               var mainScreenSize : CGSize = UIScreen.mainScreen().bounds.size // Getting main screen size of iPhone
             var imageObbj:UIImage! =   self.imageResize(UIImage(named: "bg Image.jpg")!, sizeChange: CGSizeMake(mainScreenSize.width, mainScreenSize.height))
   self.view.backgroundColor = UIColor(patternImage:imageObbj) 

After doing this setup we see again image in device that looks like this :-

   We can see in this image is fit in screen .

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 

Read More

Friday 21 November 2014

Jogendra Singh

UIPickerView make in Swift iOS

How to make or create UIPickerView in swift language

What is pickerview : - UIPickerView use for user select value by rotating the wheel for his desired value.  In pickerview have rows and component for user interface .  

Going to learn UIPickerView : -  

                  Open xCode and create new project UIPickerViewSwift  and select Swift language .

Now go in ViewController.swift and create Object of picker view 

    var pickerViewObj : UIPickerView!

  Now go in storyboard and drag and drop UIPickerView and connect to object like this :- 

also connect delegate and datasource  

adding datasource and delegate in ViewController.swift

class ViewController: UIViewController ,UIPickerViewDataSource, UIPickerViewDelegate  {

Create content array that you want to show on PickerView

    var pickerValueArray = ["Welcome", "on", "our", "site", ""]

Add datasource and delegate function of pickerview

  func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int
        return 1;
    // returns the # of rows in each component..
    func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
        return pickerValueArray.count;

//Title showing
    func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String!
        return pickerValueArray[row]

  For Selection value add this 
    func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
        NSLog("Value Printing %@",pickerValueArray[row]);

Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 

Read More

Monday 17 November 2014

Jogendra Singh

How to make UIDatePicker in iOS with Swift

Here we are going to learn UIDatePicker in swift :-

       The Date Picker in iOS 8 provides an custom Picker View that uses multiple rotating wheels to allow users to select dates and times. In this tutorial the current selected date is presented onscreen inside a label. This tutorial is written in Swift so you will need Xcode 6. It can be downloaded at Apple's developer portal.

        Open Xcode and create a new Single View Application. For product name, use UIDatePickerSwift  and then fill out the Organization Name (ex. jogendra) and Organization Identifier (Ex. com.jogendra.datePicker) with your customary values. Enter Swift as Language and make sure only iPhone/iPad/Universal is selected in Devices.

      Drag a UILabel or  UITextField (According to your requirement ) to the View Controller change the UILabel or  UITextField text to "Select Date". Next, drag a Date Picker to the View Controller and center it. The Storyboard should look like this.

Create object of both UIDatePickerView and UITextField :- 

class ViewController: UIViewController {

    var textField:UITextField!
    var datePickerObj:UIDatePicker

And Make action of UIDatePickerView
      @IBAction  func datePickerClicked( datePicker:UIDatePicker){

Connect in Storyboard

After doing these steps  do work in function of datepicker for change value 

    @IBAction  func datePickerClicked( datePicker:UIDatePicker){
        var dateFormatter = NSDateFormatter()
        dateFormatter.dateStyle = NSDateFormatterStyle.FullStyle
        var dateStr = dateFormatter.stringFromDate(
        textField.text = dateStr

It's look like this :-
Thanks for Visit  , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+ 

Read More