Monday, July 1, 2024
HomeiOS Developmentios - Easy methods to make high a part of record background...

ios – Easy methods to make high a part of record background keep fastened?


How do I make the highest a part of the record background to remain fastened?

For instance, right here, the higher a part of the record background (the sunshine gray) mustn’t slide up. In different phrases, the record background ought to solely be allowed to maneuver in the direction of the underside of the display.

enter image description here

import SwiftUI
import Basis

struct Attendance: Identifiable {
    let id = UUID()
    let title: String
}

struct AttendanceRow: View {
    var attendance: Attendance
    
    var physique: some View {
        HStack {
            Textual content(attendance.title)
        }
        .padding(.vertical, 20)
    }
}

struct ContentView: View {
    let attendances = [
        Attendance(name: "John"),
        Attendance(name: "Michael"),
        Attendance(name: "Steve"),
        Attendance(name: "Donald"),
        Attendance(name: "Johathan"),
        Attendance(name: "William"),
        Attendance(name: "Dave"),
        Attendance(name: "Richard"),
        Attendance(name: "Boris"),
        Attendance(name: "Catherine"),
        Attendance(name: "Susan")
    ]
    
    var physique: some View {
        NavigationView {
            VStack {
                Record {
                    ForEach(attendances) { attendance in
                        AttendanceRow(attendance: attendance)
                    }
                }
            }
        }
    }
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments