简体   繁体   中英

List View in iOS swiftUI [on hold]

How to Display items in List view like tableview in iOS ? I want to display my listview in Navigation view and navigate to other screen when selected.

Here you go. This will display a list with the elements 0-5. Just put this into your view body.

NavigationView {
    List (0...5, id: \.self) {element in 
        Text("\(element)")
    }
}
  NavigationView{

        VStack {
            List(0..<5, id: \.self) { element in
                NavigationLink(destination: Text("\(element)")) {
                       Text("\(element)")
                }
            }
      }
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM