Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Events cannot be dragged to a new day. This should be possible by, say, holding it over the side of the screen for a few seconds

I am working on Events functionality in Calendar and I got stuck on one thing.

Here is what I have done: I have a page/interface in which day view is visible. User can scroll to next/previous day and same view is reloaded with the specific day information. All these things are done dynamically. There are events for specific day displayed on the day view.

Issue: I want to implement the move/ Drag and Drop functionality for the event displayed. User can pick the event block and move it to another day. However I am not able to implement the same. I have attached the screenshot of the Day View in calendar with the Event visible.

Please help me move the events with event object to different days (Like Iphone4 calendar ). How can I do this?

enter image description here

like image 757
Vikas S Singh Avatar asked Sep 05 '12 06:09

Vikas S Singh


1 Answers

I assume you can't achieve the desired effect because you track movement on the Event View or the Day View. When you then load the new Day View, your gesture recognizer loses its context. If this is your problem then the following steps could help:

  1. Identify a view which is a superview to the Day View and does not unload when another Day View is loaded.
  2. Add your UITapGestureRecognizer which tracks the Event View movement to the controller of that view.
  3. Track the gesture position when the recognizer sends events in the state recognizerUIGestureRecognizerStateChanged and move the Event View as before.
  4. When the position of the gesture is at your desired target area for a Day View change, put the Event view into a new subview of the superview of the Day View, load the other Day View and keep the Event View in the foreground (and put your Event Data object into the context of the new day).
  5. When the new Day View has loaded, revert to whatever method you have used to move your Event View, now in the context of the new Day View.

Based on your sketchy question and my assumptions, this is the best answer I can give. Hope this helps.

Best, Peter

like image 124
ilmiacs Avatar answered Oct 18 '22 05:10

ilmiacs