ios, swift, iphone development tutorials, x-code development

Powered by Blogger.

Main Menu

create a TableView in ios swift xcode

create a TableView in ios swift xcode It is very simple to create a table view in ios swift.But first you know that how to create a ne...

Sunday, 20 May 2018

create a TableView in ios swift xcode


create a TableView in ios swift xcode


It is very simple to create a table view in ios swift.But first you know that how to create a new project in X-Code if you dont know then just see the last post.

before creating a tableView we learn what is table view and why we used it?

Table is used to show the data in sequential way.It gives us a vertically scroll view which consist of a number of cells(generally reusable cells). In table view some majorly  func(Function) are must used.
              1) NUMBER OF ROWS IN SECTION its stand for row in table how many rows are created in tableVIew.
                              func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
                                           {
                                             return Code
                                           }

               2) CELL FOR ROW AT INDEXPATH  this function is used to display the data in cell indexpath.

                func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell 
                        {
                                 return code
                         }
for better experience we can do it practically with example :

1. First create a x-code project.
2. after creating a project select MAIN.storyboard(its use for creating user interfaces) and select Show the object library which is shown in the image.
Show the object library
Show the object library 


3. And search the UITableVIew and drag and drop in the View Controller Scene.
UITableVIew
UITableVIew
4. After taking the tableView first we set the constraints for auto set on all iphones.

Add Constraints
Add Constraints
5. Now set the Prototype Cell 1.
set prototype cell
set prototype cell
6. create a cocoa Touch Class file gives name which you want to give example like:- TableViewCell.swift.
 cocoa Touch Class
 cocoa Touch Class
7. Select the subclass of UITableViewCell and click next.

subclass of UITableViewCell
subclass of UITableViewCell
8. select the Identity Inspector and set the custom class as your subclass of UITableViewCell name.
Identity Inspector
Identity Inspector

9. Now drag and drop the the lable in prototype cell from object library. for showing the data.


Drag and Drop Lable
Drag and Drop Lable
10. After drag and drop the lable set the constraints of lable in prototype cell.
11. create outlet for the lable in your Subclass of uitable view cell.

12. Code of TableViewCell(subclass of UITableViewCell).

//
//  TableViewCell.swift
//  TableViewExample
//
//  Created by MICROLET on 20/05/18.
//  Copyright © 2018 MICROLET. All rights reserved.
//

import UIKit

class TableViewCell: UITableViewCell {

    @IBOutlet weak var lableName: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}

13. code for the table view functions is:-

//
//  ViewController.swift
//  TableViewExample
//
//  Created by MICROLET on 18/05/18.
//  Copyright © 2018 MICROLET. All rights reserved.
//

import UIKit

class ViewController: UIViewControllerUITableViewDelegateUITableViewDataSource {
    
    
    var names = ["Aviansh""Kapil""Muskan""Renu""Nisha""Lalit""Tammy""Jully"]
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return names.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
     
        let cell: TableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) asTableViewCell
        cell.lableName.text = self.names[indexPath.row]
        return cell
    }
    

    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.
    }


}

14. After writing this code just build and run the app in your simulator and your output is boomb..!!

Output gadget simulator
Simulator
Thanks for reading this post Hope you enjoyed this post and know abot how to create the TableView in IOS SWIFT X-CODE.
















  

Thursday, 17 May 2018

how to create a simple project in iOS swift


Today we learn about how to create a simple project in swift 

1) X-CODE is installed in your Mac.
2) Select the File option then a menu list pop-up and select new -> Select Project (see in this picture for better understand)
Select File option for new project

 3) After selecting this a pop-up view will appear see image which is below this line

Choose a template for your new project


4) After choose this template for new project then select single view application and click next then again a pop-up view will appear see the next image

Choose option for your new project
 


5) Choose option for your new project in this pop-up first give a name to project (for example MyFirstApp).

6) Select language is swift and hit next button.
7) After hitting the next button again a pop-up view will appear.This window is show the placing address where we want to store our project. so where you want to store your project Choose your location and hit the button


Project location where our project is stored


8) After click choose then our project is saved our location. After saving the project our project is created and the project is show just like this image 


Project is created succefullyy











Thursday, 3 May 2018

How can we get 4000 hours and 1000 subscriber in 12 months


How can we get 4000 watching hours and 1000 subscriber in 12 months

Dosto aj hum dekhenge ki kese hum 12 months main 4000 watching time get kar skte hai or 1000 subscriber apne  Youtube channel pe la skte hai..!!

Dost ye krna bhut hi aasan trika hai. or bhut hi kam time period m hum 4000 watching hours and 1000 subscriber youtube pe la skte hai. Dost esme aapko kuch nahi krna bus aapko google or youtube pe chal rhe trend fashion k bare m pta lgana hai ki aj k time kya chal rha hai.Basically krna kuch nahi 
nahi hai aapko kewal aapke interest wale topic pe jo sabse jyada popular cheeze h unka pta krna hai.

FOR EXAMPLE:- jese ki ye abhi youtube ki nai policy aayi hai. 12 months main 4000 watching hours and 1000 subscriber. pehle 10,000 views pe adsense mil jata tha.

Abhi ap esi tarike ko use le skte hai. Idea bhale hi kisi ka ho its doesn't metter but the way of explanation is different from idea and writting content are also different from someone else content.
if  we copy the content of other's blogs and website then the google adsense was tag that content as copyright content.

To dosto ap logo ko ek idea mil gaya ki kese hum watching hours bdha skte hai apne youtube pe.Aese but se tarike hai ap unhe search kijiye or un per video create kijiye apne hisab se aapko koi copyright content nahi aayega or aapka youtube channel ko watching hours milenge subscriber milenge or aapko esse achi earning hogi.

THANKS..! For reading this artical. I hope you enjoyed this artical.