Friday, 30 September 2016

Monday, 19 September 2016

How to create Multiple Target in Xcode Project in iOS

Today We will learn how to create Multiple Targets in Xcode Project and setting different image.xcassets for them.

Full Code and Explanation here.

Sunday, 18 September 2016

A Simple TableView example in Swift iOS

Hi Friends, Earlier we learnt how to create tableView in iOS using objective C. Today we
will learn how to create a simple tableView in iOS using Swift.

Thursday, 15 September 2016

A Simple Date Picker in Swift iOS

Today We will learn how to make a simple Date Piker using Swift in iOS


Steps:

1. Create a new Xcode Project (Lets say DatePickerInSwift).
2. Now go to StoryBoard and take a DatePicker, toolbar and two bar button items, one UIButton and one UILabel . Your StoryBoard will look like this.



3. Now make connection for DatePicker, Toolbar, UiLabel and UIButton



@IBOutlet weak var dateToolBar: UIToolbar!
@IBOutlet weak var datePicker:UIDatePicker!
@IBOutlet weak var dateLabel:UILabel!



@IBAction func toolBarCancelItem(sender: AnyObject) {
}
@IBAction func doneButtonItem(sender: AnyObject) {
}
@IBAction func showDatePickerButtonAction(sender: AnyObject) {


}
4. Now we will first hide the toolBar, dateLabel and DatePicker and then on Button Click we will unhide it. We will just take the date vale from datepicker and will write into Label.
override func viewDidLoad() {
        super.viewDidLoad()
        self.dateLabel.hidden = true
        self.datePicker.hidden = true
        self.dateToolBar.hidden = true
        // 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.
    }

    @IBAction func toolBarCancelItem(sender: AnyObject) {
        self.dateLabel.hidden = true
        self.datePicker.hidden = true
        self.dateToolBar.hidden = true
        
    }
  
    @IBAction func doneButtonItem(sender: AnyObject) {
        let dateFormatter = NSDateFormatter()
        dateFormatter.dateFormat = "dd-MM-yyyy HH:mm"  // Here You can customize the formatter according to Your use.
        let strDate = dateFormatter.stringFromDate(datePicker.date)
        self.dateLabel.text = strDate

        
    }

    @IBAction func showDatePickerButtonAction(sender: AnyObject) {
        self.dateLabel.hidden = false
        self.datePicker.hidden = false
        self.dateToolBar.hidden = false
    }

5. Now run the code. Press the showDatePicker Button and then select any date and press Done Button. You will see the value in the Label.


You can share your feedback.
You can download the whole Xcode (7.3) Project from here.

Enjoy Coding :)

Saturday, 10 September 2016

Ads Inside Post

Blogger Widget