Thursday, October 27, 2016

iPhone - First App (Happy Diwali) / Check u r Eligibility to play with Crackers ...

Dear All....

Are you crazy for iPhone Development .......................
OOOKKkkk.......   So  let's start something new on this Diwali .........

As you know my way ....... i m always adding the stuff in which code is more......
Just for your info.........
I m using Xcode 7.3 as a IDE and Swift as a programming language.
I would like to suggest you to prefer Apple machine to develop App for iPhone.
If you r using Window OS then You may be stuck due to VMWare and can't enjoy the real feel ...
But it's OK with Window OS also... but u should have patience......
So.... Good Luck ....

Few steps are.....

Step - 1. Launch your Xcode
Step - 2. Create a new project with Single View App options
Step - 3. Design whatever you want to add as a UI Component on Main.storyboard
Step - 4. Add All labels , Buttons with the Controller file which is ViewController.swift
Step - 5. Add Appropriate code in this controller file.
Step - 6 . Select Emulator as you wish and run the app.

See My First App with the following functionalities....
1. Diwali Greetings by Text Message
2. Image Addition
3. Just to take input from user i added a TextField to insert value
4. Also added a button to add event
5. Just twice you entered value and display a message for fun........

A. Output will be like .....

1.

2.

3.

B. Swift code is as

import UIKit

class ViewController: UIViewController {

    @IBOutlet var label: UILabel!
    @IBOutlet var msg: UILabel!
    @IBOutlet var textField: UITextField!
    @IBAction func submit(sender: AnyObject) {
     
        var data = Int(textField.text!)!
        
        data = data * 2
        
        if data>=18
        {
        msg.text = "You can Play with Crackers..."
        }
        else
        {
            msg.text = "Not Eligible"
            
        }
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }



}



  

No comments:

Post a Comment