iOS

UITableView & UICollectionView

UITableView, UICollectionView, data sources, delegates, cell reuse, custom cells

25 câu hỏi phỏng vấn·
Mid-Level
1

What is the main purpose of the dequeueReusableCell method in UITableView?

Câu trả lời

The dequeueReusableCell method retrieves a reusable cell from the recycling pool. This optimizes memory by reusing off-screen cells rather than creating new instances constantly. This is critical for maintaining smooth performance during scrolling.

2

Which UITableViewDataSource method returns the number of rows in a given section?

Câu trả lời

The tableView(_:numberOfRowsInSection:) method from UITableViewDataSource returns the row count for each section. It's called by UITableView to calculate total height and manage cell recycling. This method is mandatory to implement.

3

What is the main advantage of using UICollectionViewFlowLayout over a custom layout?

Câu trả lời

UICollectionViewFlowLayout provides a prebuilt optimized grid layout that automatically handles spacing, alignment, and cell wrapping. It avoids implementing complex layout logic and is highly configurable through properties like minimumLineSpacing, itemSize, and sectionInset.

4

How to combine numberOfSections and numberOfRowsInSection methods for a multi-section structure?

5

Which protocol provides methods for handling selection events in a UICollectionView?

+22 câu hỏi phỏng vấn

Nắm vững iOS cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí