Post

Replies

Boosts

Views

Activity

Reply to Adding UIPointerInteraction to UICollectionViewCell
I implemented the below code from Apple Documentation:if #available(iOS 13.4, *) { func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? { var pointerStyle: UIPointerStyle? = nil if let interactionView = interaction.view { let targetedPreview = UITargetedPreview(view: interactionView) pointerStyle = UIPointerStyle(effect: UIPointerEffect.lift(targetedPreview)) } return pointerStyle } }But it is gets applied on buttons on Navigation bar but not on UICollectionViewCell...I even tried this link: owncloud.org/news/of-mice-and-mobile-devices-implementing-mouse-interaction-in-ipados-13-4/But I don't know how to apply the same hover effect on UICollectionViewCell...!!!
Apr ’20
Reply to Rearrange collection view cells within it's section
I used your suggestion of 'if (sourceSection == destSection)' but user is able to still drag from section 1 to 0... Also used your code for else statement but it never gets called. I think answer should be Collection View 'Section' Specific. As per requirement user should be able to only move cells within sections i.e. Section 1 cells should be rearranged within section 1 only..
Apr ’21
Reply to Refreshing / Reloading Data of Supplementary View (Header & Footer) for Collection View
Hi, I create UILabel by Adding it as a subview to header... Here is my code for Header at '0'... override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) - UICollectionReusableView { let reusableview = UICollectionReusableView() if (kind == UICollectionView.elementKindSectionHeader) { print("section \(indexPath.section)") if indexPath.section == 0 { let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: collectionViewFirstHeaderFooterReuseIdentifier, for: indexPath) headerView.backgroundColor = .clear let headerUILabelText = UILabel() headerUILabelText.textAlignment = .left headerUILabelText.font = UIFont.systemFont(ofSize: 20, weight: .bold) headerUILabelText.numberOfLines = 0 headerUILabelText.text = "Your Roll Number is \(NumberInteger). Your Exam Numbers are \(examNumbers(number: "\(NumberInteger)"))" headerUILabelText.textColor = .darkGray headerUILabelText.lineBreakMode = .byTruncatingTail headerView.addSubview(headerUILabelText) headerUILabelText.setMargins() headerUILabelText.isHidden = false headerUILabelText.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ headerUILabelText.leadingAnchor.constraint(equalTo: headerView.leadingAnchor), headerUILabelText.trailingAnchor.constraint(equalTo: headerView.trailingAnchor), headerUILabelText.centerXAnchor.constraint(equalTo: headerView.centerXAnchor), headerUILabelText.centerYAnchor.constraint(equalTo: headerView.centerYAnchor), headerUILabelText.topAnchor.constraint(equalTo: headerView.topAnchor), headerUILabelText.rightAnchor.constraint(equalTo: headerView.rightAnchor), headerUILabelText.bottomAnchor.constraint(equalTo: headerView.bottomAnchor), headerUILabelText.leftAnchor.constraint(equalTo: headerView.leftAnchor), headerUILabelText.widthAnchor.constraint(equalToConstant: headerView.frame.width), headerUILabelText.heightAnchor.constraint(equalToConstant: headerView.frame.height) ]) return headerView } else if indexPath.section == 1 { let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: collectionViewSecondHeaderFooterReuseIdentifier, for: indexPath) return headerView } else { return reusableview } }
Apr ’21