Tuesday, March 26, 2013

GMGridview long press delete and moving cell at same time

GMGridview is very essential library project for cell manipulation for iOS project which are moving cell and delete cell and etc.But I have seen there was a problem you can't add two animation with same time like when moving and delete animation with same time.

So i have changed it as i want ,


Problem is : long-press delete and moving cell same time.

Solution is : when you are long pressing,it active the delete mode then if you want delete cell ,you can delete  it , if you want to moving cell you can move cell but while moving delete mode is deactivate and after releasing cell delete mode also active again.

So i have create sub class of GMGridview and change the rules what you want.But some methods and variables are private So you should move in to GMGridview.h file .

Step 1  : Add properties to GMGridview header file 



And syntheses the this properties and remove private variable these name in GMGridview.h file.

 Step 2  : Add methods to GMGridview header file 

Step 3    : create sub class of GMGridview and changed rules as follow(GMGridViewSub)
Step 3.1 : Header file

















Step 3.2 : Implementation file(m)
Step 3.2.1 : Import header file and constant as follow 

















Step 3.2.2 : Add following init and function within implementation scope as follow

It first call super class function and then run remainder task.Change the valid rule as following code because it check without editing.


Longpress GestureUpdate : Add the moving editing animation as follow and
SortingMoveDidStart :  before start the moving edit mode is NO 





























Change following function Edditing is yes and after stop the animation changed it as

if(self.editing)
     self.sortMovingItem.editing =YES;
















While moving cell editing flag is NO








Now you have developed the sub class of GMGridView and then you can call the subclass as you want instead of GMGridView Add this reference as you wanted class as follow.

GMGridViewSub *gmGridView = [[GMGridViewSub alloc] init];


15 comments:

  1. It doesn't work. Can you show project with example?

    ReplyDelete
    Replies
    1. I have sent you email with attachment and use it as you want...

      Delete
    2. Can you please send an example as well?

      Delete
  2. Can you please send an example as well?
    my email address is Tomerubin@gmail.com
    I would appreciate it!
    Thanks!

    ReplyDelete
  3. Can you please send an example as well?
    my email address is peixun.net@gmail.com

    thanks

    ReplyDelete
  4. I have emailed as you want... :)

    ReplyDelete
  5. can you please send me an example too :)
    email: khaloo.hastam@gmail.com

    ReplyDelete
  6. can you please send me an example too,, Thanks
    email: avinashkiran001@gmail.com

    ReplyDelete
  7. Hey Roshan,

    That's an excellent work!

    As the workaround code above is in images :) it's too difficult to get to the correct way. Can you pls send me the code as well at mayank.nakrani@hotmail.com?

    ReplyDelete
  8. Download link https://github.com/chathurka/GMGridView and subclass name is GMGridViewCustom.

    ReplyDelete
  9. can you please send me an example too :)
    email: yuhui@updays.net

    ReplyDelete
  10. can you please send me an example too :)
    email: shaikmohsin.87@gmail.com

    ReplyDelete
  11. would you please send me an example also?

    email: mili2k@yahoo.com

    ReplyDelete
  12. can you please send me an example too :)
    email: rahul.vyas.09@gmail.com

    ReplyDelete