Giter Site home page Giter Site logo

lprtableview's People

Contributors

edwinfinch avatar hendx avatar laptopmini avatar nicolasgomollon avatar pjh68 avatar supergeroy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lprtableview's Issues

Memory Leak: longPressReorderDelegate creates strong reference cycle

The definition of longPressReorderDelegate creates a strong reference cycle when used, which means the class you assign to it is never deinit() which creates a memory leak.

This is because the delegate is declared as:

open var longPressReorderDelegate: LPRTableViewDelegate!

When it should be:

weak open var longPressReorderDelegate: LPRTableViewDelegate?

Notice I also removed the forced unwrap as delegates should always be optionally unwrapped. Which is done everywhere in the code, so it's surprising it was declared as such.

Other cells than Basic is not shown

Downloaded the sample ReorderTest and changed the style to "Subtitle"
Added cell.detailTextLabel?.text = object.description to cellForRowAtIndexPath

This stil gives me the same basic tableviewcell.

Some compile error

I' m using Xcode 6.4. It compiles shows 2 error on the following code:

public convenience override init()  {
        self.init(frame: CGRectZero)
    }

removing the override fixed the error of LPRTableView.swift:55:30: Initializer does not override a designated initializer from its superclass.

public var lprTableView: LPRTableView! { return tableView as LPRTableView }

changing as to as! fixed the error of LPRTableView.swift:304:60: 'UITableView!' is not convertible to 'LPRTableView'; did you mean to use 'as!' to force downcast?

Dragging a cell to the a different row too fast will mess up more rows

Hello, I'll use this opportunity to say thank you for sharing this with us.

I ran into an issue that I'm trying to solve with your approach at dragging cells.
I suspect the problem is somewhere around the
//reload the rows that were affected just to be safe
or at the moveRowAtIndexPath function.

When you drag the cell slow and gentle everything works perfectly but when you drag the cell fast and kind of drop it as if you wouldn't care where it will land or you move it around the table quick without releasing and then drop it quick what will happen is that more than one cell will chage it's text as if more than one cell's content has moved it's row. It just looks like if you release the cell before it falls into the new row it will call the moveRowAtIndexPath more than once.

Say we have 7 rows that display 1 to 7 in ascending order and we drag a cell and move it quick and drop and let's say it landed at 2, instead of only the cell 7 and 2 to switch positions another random cell pair along the path(in this case 4 and 5) will change the position and the result will look like.

1
7
3
5
4
6
2

The more rows you have the more likely this will happen.
I hope I was clear enough. Let me know if you need a video to demonstrate this.

Thank you!

Minor Issue: Incorrect cell change if mass cell movement

Noticed this in the latest build. iOS 10.3.1

If you click and drag one view, then rapidly move it up and down between some views, one view will stop moving and stay either higher or lower than it should. After dropping the selected cell when this occurs, the cell which was misplaced earlier will sometimes teleport to another location.

Thank you for the great library. Saved me a lot of stress, and the code is very top quality. :)

EDIT: Noted that an issue was closed for it here, although the bug does still seem to persist: #5

Method for Committing Reorder Changes

This is really nice, thank you! :)

I know that the moveRowAt method fires when you reorder the cells, but it fires each time the row moves, even if the user hasn't let go yet.

Is there a method that fires when a user lets go of the cell and commits the reorder change? That's when I'd like to save the data to my database.

Not working with custom tableViewCell

If the prototype cell is a custom class, it crashes.

I create my custom cell

< class MyCellClass: UITableViewCell {>
< // code>
< }>

I associate it with the prototype cell in the storyboard.
And it crashes on this line :
< let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! MyCellClass>

=> Could not cast value of type 'UITableViewCell' (0x10bf7ec68) to 'ReorderTest. MyCellClass'

Is there a way to avoid that ?

Cannot drop the cell into a collapse section

Hello, i implemented an expand collapse logic on the section with your framework working behind for the autoscroll and the drag and drop.
Though i encountered a problem, i cannot drop the cell in a collapse section, it works sometimes but never for the first section which is at the top of the screen.
Any idea on where i should focus to change that?

Problem with cancelling the drag&drop

Hello,

There is a problem when the user cancels the drag&drop, e.g. by leaving the app. When the user then resumes their activity, the cell still looks like it's being dragged although there is no drag&drop action going on (anymore).

To reproduce:

  • pick a cell and drag it around
  • while still dragging, press the Home button of the device (the app closes)
  • reopen the app again

I guess we should cancel the drag&drop (either accepting or rejecting the current position) somewhere around here:
if gesture.state == .cancelled

Implement LPR For TableView Sections?

Is it possible to implement this framework for re-ordering sections by getting indexPath from a selected point. I can manage to do it on my own without this framework but I am having difficulties with the scrolling so I was wondering if I could use this instead.

Even with this framework I have got it working to move the sections but I cannot implement the scrolling again.

Odd behaviour when height for cell larger than the standard height in iOS 11

Hi there, absolutely love the library.

I recently discovered an issue in testing that is easily reproducible. I'm going to try and fix it myself though I figured I'd share it here too in case anyone else already has a solution.

Issue
When the cell height is greater than the standard height (which I believe is 44), and you move a cell near the bottom of the table view, the cells jump around the screen in an odd manner. Please note you have to have more cells than can fit on the screen to reproduce this.

Video demonstration

https://www.youtube.com/watch?v=MlTH87Wj7so

Steps to reproduce

  1. I believe this issue may only occur on iOS 11. I cannot reproduce it on an iPad running iOS 9.3.5 or an iPhone 6 running iOS 10.3.3, so ensure you're running iOS 11.

  2. Override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat and return a value of 100 (my testing value).

  3. Ensure there are at least 2 "full screens" worth of rows.

  4. Go to the bottom of the table view, begin to drag & drop any cell near the bottom. Move it upwards or downwards and notice the odd behaviour.

Thanks for reading!
Edwin

Using LPRTableViewController as Class Inheritance Results in "unable to dequeue a cell with identifier"

Following your example I set my ViewController for my TableViewController View to inherit LPRTableViewController and I am getting "unable to dequeue cell" errors.

The cells exist, they are Custom Prototypes in the TableViewController, no custom classes. If I modify

func registerClasses() {
    tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "newIdentifier")
}

Then I have to unwrap all the labels and no values are displayed.

If I leave my TableViewController inheritance as UITableViewController and set the table view of the TableViewController to LPRTableView it does work, but hideDraggingView is never triggered.

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.