소스 검색

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 주 전
부모
커밋
02c4fd2373
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      classroom_app/ViewController.swift

+ 5 - 2
classroom_app/ViewController.swift

@@ -2279,7 +2279,7 @@ private extension ViewController {
2279
         stack.userInterfaceLayoutDirection = .leftToRight
2279
         stack.userInterfaceLayoutDirection = .leftToRight
2280
         stack.orientation = .vertical
2280
         stack.orientation = .vertical
2281
         stack.spacing = 14
2281
         stack.spacing = 14
2282
-        stack.alignment = .width
2282
+        stack.alignment = .leading
2283
         enrolledPageCardsStack = stack
2283
         enrolledPageCardsStack = stack
2284
         scroll.documentView = stack
2284
         scroll.documentView = stack
2285
 
2285
 
@@ -6114,11 +6114,14 @@ private extension ViewController {
6114
                 emptyLabel.centerYAnchor.constraint(equalTo: empty.centerYAnchor)
6114
                 emptyLabel.centerYAnchor.constraint(equalTo: empty.centerYAnchor)
6115
             ])
6115
             ])
6116
             stack.addArrangedSubview(empty)
6116
             stack.addArrangedSubview(empty)
6117
+            empty.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
6117
             return
6118
             return
6118
         }
6119
         }
6119
 
6120
 
6120
         for course in courses {
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