Giter Site home page Giter Site logo

Comments (3)

Yonodactyl avatar Yonodactyl commented on June 9, 2024

Do you have a little more context? Have you connected the collection view to a delegate, if so, what's the delegate? Post a little more code and others might be able to help!

from jelly.

trusbe avatar trusbe commented on June 9, 2024

@Yonodactyl Hello, I'm very sorry, the following is the supplementary content.

This is the entrance, which can be loaded normally:

let vc = ATHFuncVC()
let uiConfiguration = PresentationUIConfiguration(cornerRadius: 16, backgroundStyle: .dimmed(alpha: 0.3), isTapBackgroundToDismissEnabled: true, corners: [.layerMaxXMaxYCorner,.layerMaxXMinYCorner,.layerMinXMaxYCorner,.layerMinXMinYCorner])
let size = PresentationSize(width: .fullscreen, height: .halfscreen)
let alignment = PresentationAlignment(vertical: .bottom, horizontal: .center)
let timing = PresentationTiming(duration: .medium, presentationCurve: .easeIn, dismissCurve: .easeOut)
let interactionConfiguration = InteractionConfiguration(presentingViewController: self, completionThreshold: 0.5, dragMode: .canvas)
let presentation = CoverPresentation(directionShow: .bottom,
                                     directionDismiss: .bottom,
                                     uiConfiguration: uiConfiguration,
                                     size: size,
                                     alignment: alignment,
                                     marginGuards: .zero,
                                     timing: timing,
                                     spring: .none,
                                     interactionConfiguration: interactionConfiguration)
animator = Animator(presentation:presentation)
animator?.prepare(presentedViewController: vc)
present(vc, animated: true, completion: nil)

This is a subview in ATHFuncVC:

let funcView = ATHFuncView()
funcView.getInfo { (row) in
    logger("ATHFuncVC", sub: "funcView", info: "Index: \(row)")
}
self.view.addSubview(funcView)

There is a UICollectionView in the ATHFuncView view:

let layout = UICollectionViewFlowLayout.init()
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = .clear
collectionView.dataSource = self
collectionView.delegate = self
collectionView.allowsSelection = false
collectionView.allowsMultipleSelection = false
collectionView.alwaysBounceVertical = false
collectionView.showsVerticalScrollIndicator = false
collectionView.register(ATHFuncCell.self, forCellWithReuseIdentifier: cellId1);
self.addSubview(collectionView)
// MARK: - UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout
extension ATHFuncView: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        let contentSize = (ScreenWidth-10*8)/4
        return CGSize(width: contentSize, height: 80)
    }
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
        return UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
    }
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
        return 8
    }
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
        return 8
    }
        
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 1
    }
    
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 4
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId1, for: indexPath) as! ATHFuncCell
        switch indexPath.row {
        case 0: cell.setInfo("home_func_loc", title: "Real-time location".localized())
        case 1: cell.setInfo("home_func_fence", title: "Electronic fence".localized())
        case 2: cell.setInfo("home_func_Leash", title: "Electronic traction".localized())
        default: cell.setInfo("home_func_his", title: "History data".localized())
        }
        
        return cell
    }
    
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        logger("ATHFuncView", sub: "didSelectItemAt", info: "Row:\(indexPath.row)")
        // Will not respond here
        if callBackInfo != nil {
            callBackInfo!(indexPath.row)
        }
    }
}

I looked up the information on the Internet, and some people said that it might be a gesture conflict. How can I set it in Jelly to avoid this situation?

Thank you very much for replying.

from jelly.

trusbe avatar trusbe commented on June 9, 2024

😅 I found the problem and forgot when I turned it off.

collectionView.allowsSelection = false 

from jelly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.