1

I remember that one of the WWDC 2011 videos that dealt with scrollview had a demo, where the presenter (Eliza) demonstrated how to infinitely scroll along a scrollview. The demo used a bunch of pre-generated houses and the moon.

Here's the link to the slides, but I do not see the houses demo, or related code. http://adcdownload.apple.com//wwdc_2011/adc_on_itunes__wwdc11_sessions__pdf/104_advanced_scroll_view_techniques.pdf

here's the code that they have available, but this is not the demo with the houses and the moon: http://developer.apple.com/library/ios/samplecode/StreetScroller/Introduction/Intro.html

The thing that interests me from that demo is how Eliza was able to pick up the moon with a long press and position it anywhere on the UIScrollView. I would like to add a similar technique to my app.

I've checked the source code for the advanced scrollview techniques, and it does not have that example.

Can anyone help me find out how to pick up a UIControl and drag and position it anywhere within a hosting view using longpress?

Update:

I found this code:

[button addTarget:self action:@selector(draggedOut:withEvent: ) forControlEvents: UIControlEventTouchDragOutside | UIControlEventTouchDragInside];

- (void) draggedOut: (UIControl *) c withEvent: (UIEvent *) ev {

    c.center = [[[ev allTouches] anyObject] locationInView:self.markerView];
}

This picks up and positions the button, however, the button also gets activated as a result of the touch. The drag event begins almost immediately, while I would like to have at least a second of delay and a scaling effect to indicate that the button has been selected.

Any help is appreciated!

Alex Stone
  • 46,408
  • 55
  • 231
  • 407

1 Answers1

1

I'm not sure, but maybe subclassing UIButton will help you On Stackoverflow

Or on Isignmeout are tutorials for that.

Community
  • 1
  • 1
MadMaxAPP
  • 1,035
  • 2
  • 16
  • 39
  • This is getting closer. I do remember that the code used a long press recognizer, and it probably dropped the UIControl when the gesture ended. What I'm having trouble recalling is whether it used a single gesture recognizer or a combination of long press with something else – Alex Stone Nov 22 '11 at 16:18