Tôi có một UITableview
. Một trong số UITableViewCell's
là một UICollectionview
với tên dụ "amenityView". UICollectionViewDelegate
và UICollectionViewDataSource
được đặt trong storyboard
như được hiển thị bên dưới. Các phương thức sau được gọi và dữ liệu được điền như mong đợi.collectionXem: didSelectItemAtIndexPath: không được gọi là
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- (UICollectionViewCell *)collectionView:(UICollectionView *)collection cellForItemAtIndexPath:(NSIndexPath *)indexPath
Tuy nhiên, phương thức dưới đây không được gọi khi tôi chọn UICollectionViewCell
chứa trong UICollectionView
. Tôi đã bỏ lỡ điều gì?
-(void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
-(void) collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
UPDATE: trở YES trong phương pháp này collectionView:shouldSelectItemAtIndexPath:
sẽ gọi dưới hai phương pháp. Ít nhất đó là những gì còn thiếu trong phần của tôi. Hy vọng điều này sẽ giúp một số nội dung ...
là ["' .allowsSelection' "] (https://developer.apple.com/library/ios/documentation/uikit/reference/UICollectionView_class/Reference/Reference.html#//apple_ref/occ/instp/UICollectionView/allowSelection) cho chế độ xem bộ sưu tập của bạn được đặt thành CÓ? –
@MichaelDautermann. Cám ơn phản hồi của bạn. ".allowsSelection" được đặt thành "CÓ". – Loozie
không phải là ô xem bảng mà nó đang cho phép tương tác người dùng hoặc lựa chọn của chính ô đó? –