Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow control on actions container view please #11

Closed
alexbuga opened this issue Feb 27, 2017 · 7 comments
Closed

Allow control on actions container view please #11

alexbuga opened this issue Feb 27, 2017 · 7 comments

Comments

@alexbuga
Copy link

My row view has a bottom margin and there's a discrepancy between the actions and the row.
I'll attach 2 screenshots: my custom implementation with a scrollview inside the row, and how it looks with SwipeCellKit.

screenshot 2017-02-27 11 16 44
screenshot 2017-02-27 11 18 12

@alexbuga
Copy link
Author

I think I'll need to tinker with var actionsView: SwipeActionsView? from the SwipeTableViewCell

@mohsinalimat
Copy link

Hello,

SwipeActionsView.swift file

implement like below lines...

func addButtons(for actions: [SwipeAction], withMaximum size: CGSize) {
subviews.forEach { $0.removeFromSuperview() }

    for action in actions {
        let actionButton = SwipeActionButton(frame: CGRect(origin: CGPoint(x: 0, y: size.height/2-30), size: CGSize(width: size.width * 2, height: 60)), action: action)
        addSubview(actionButton)
        
        actionButton.addTarget(self, action: #selector(actionTapped(button:)), for: .touchUpInside)
        
        minimumButtonWidth = max(minimumButtonWidth, actionButton.preferredWidth)
        
        switch self.orientation {
        case .left:
            let maskPAth1 = UIBezierPath(roundedRect: actionButton.bounds,
                                         byRoundingCorners: [.topRight , .bottomRight],
                                         cornerRadii:CGSize(width: 30, height:  30))
            let maskLayer1 = CAShapeLayer()
            maskLayer1.frame = actionButton.bounds
            maskLayer1.path = maskPAth1.cgPath
            actionButton.layer.mask = maskLayer1
        case .right:
            let maskPAth1 = UIBezierPath(roundedRect: actionButton.bounds,
                                         byRoundingCorners: [.topLeft , .bottomLeft],
                                         cornerRadii:CGSize(width: 30, height:  30))
            let maskLayer1 = CAShapeLayer()
            maskLayer1.frame = actionButton.bounds
            maskLayer1.path = maskPAth1.cgPath
            actionButton.layer.mask = maskLayer1
        }
    }
}

@alexbuga
Copy link
Author

Well I wanted a clean way of accessing the view from my controller, not to tinker with SwipeCellKit code.
That's what I did eventually. Modified the actionView 'cuz that's what I needed.

@jerkoch
Copy link
Contributor

jerkoch commented Feb 27, 2017

Hey @alexbuga - Good to hear you managed to get it working. Any chance you can share a sample project?

I've haven't had a chance think about the best way of accommodating this... maybe it's as simple as exposing the SwipeActionsView. Since the actionView extends outside of the cell bounds, I'm not clear how you got the rounded corners all around.

@alexbuga
Copy link
Author

alexbuga commented Feb 27, 2017 via email

@jerkoch jerkoch mentioned this issue Apr 20, 2017
@kurabi
Copy link
Member

kurabi commented Jun 26, 2017

This work is not in scope for now but I will welcome pull requests to support something like this.

@kurabi kurabi closed this as completed Jun 26, 2017
@ghost
Copy link

ghost commented Apr 24, 2018

@alexbuga
I want to talk to you about how to do this round in this ActionButton plz !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants