Kaynağa Gözat

Fix enrolled cards alignment in page layout.

Anchor enrolled cards to the content column by using leading stack alignment and explicit width constraints so class cards render under the heading instead of drifting to the right.

Made-with: Cursor
huzaifahayat12 1 hafta önce
ebeveyn
işleme
02c4fd2373
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      classroom_app/ViewController.swift

+ 5 - 2
classroom_app/ViewController.swift

@@ -2279,7 +2279,7 @@ private extension ViewController {
2279 2279
         stack.userInterfaceLayoutDirection = .leftToRight
2280 2280
         stack.orientation = .vertical
2281 2281
         stack.spacing = 14
2282
-        stack.alignment = .width
2282
+        stack.alignment = .leading
2283 2283
         enrolledPageCardsStack = stack
2284 2284
         scroll.documentView = stack
2285 2285
 
@@ -6114,11 +6114,14 @@ private extension ViewController {
6114 6114
                 emptyLabel.centerYAnchor.constraint(equalTo: empty.centerYAnchor)
6115 6115
             ])
6116 6116
             stack.addArrangedSubview(empty)
6117
+            empty.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
6117 6118
             return
6118 6119
         }
6119 6120
 
6120 6121
         for course in courses {
6121
-            stack.addArrangedSubview(enrolledClassCard(course: course))
6122
+            let card = enrolledClassCard(course: course)
6123
+            stack.addArrangedSubview(card)
6124
+            card.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
6122 6125
         }
6123 6126
     }
6124 6127