Handling UITableCell move left (or move right) event? - iphone

I want to creat an UITableView which each cell (UITableCell) in this table can be moved left or moved right (System will be notified when user touchs down the cell and moves finger to left or right). Anybody can tell me how can i do it :) Thanks :)
I want to build a Table which each TableCell in it become a menu likes image bellow when user touch up TableCell and move finger to left or right!

I would guess this is done by watching for the touch events, being the first responder and monitor all touch events before you send them further to the UITableView under.
I think there is a source code from Apple that shows this.. think it's called Gestures or TableView Gestures... do a search on the Apple site.
Also, do read on the UIGestureRecognizer docs from the SDK. These can be attached to a certain view, I read.
Good luck, let us know if you're successful.

Related

Two finger swipe on a UITableView

I am using a UITableView in my application to show a set of images under each section in a UITableView.I have a requirement which makes the UITableView to scroll to next section if the swipe is done with two fingers.
Can some one help me in making the UITableView respond to two finger swipe.I tried by assigning a swipe gesture with number of touches assigned to two but the table responds to normal traditional scroll.
Can someone suggest a way to implement this.If possible with pieces of code which is well appreciated.
TNQ
[swipeGesture setCancelsTouchesInView:TRUE];
This will make the gesture recognizer swallow the touches.
Hope this helps.
Cheers!

Swipe to change UIViewContent

Hej folks,
I got an UIView in my application and want to implement kind of a swipe gesture. I know how I detect this gesture (touchesBegan: and touchesEnded: for example is x coordinates are distanced more than 100 pixels or something else) but I really don´t now how to animate my needs. In fact my UIView will contain subviews which are 9 UIButtons. On swipe I want to change the set of buttons programatically...any solutions out there? Primarily need the animation!
EDIT: I thought about programatically moving the buttons off-screen to the left and at the same time move the new ones on-screen from the right side. But it seems I don't really know how to realize this...isn't it too much leaking at the same time? Please give me a hint!
It's seem that you want to recreate somethings like the springboard but with button instead of icon.
I can suggest you to use UIScrollView.
why you don't load just a new view with the other button set in your window after the swipe gesture was detected?

Dragging a touch along a row of UIButtons

I have a row of say 10 UIButtons along the bottom of the iPhone screen. The user can TouchUpInside each of these. I'd also like to allow the user to drag their finger along the row, deselecting the previous button that was touched when the finger is over the next. This kind of behaviour is seen on iPhone's keyboard.
The obvious thing to try is UIControlEventDragOutside or UIControlEventDragExit to trigger the appropriate actions however these only work when the touch event is sufficiently far away from the button. As my buttons must sit flush against each other this is not good enough for me.
Suggestions?

Drag & sweep with Cocoa on iPhone

I'm about to start a new iPhone app that requires a certain functionality but I'm not sure if it's doable. I'm willing to research but first I just wanted to know if I should at least consider it or not.
I haven't seen this in an app before (which is my main concern, even though I haven't seen too many apps since I don't own an iPhone), but an example would be the iPhone shortcuts panels: you can hold on an app, and then drag it to another panel, sweeping while still dragging it. But this is the core app, is it possible to reproduce something similar within a normal app?
I only need to be sure it can be done before I start digging, I don't need code examples or anything, but if you have some exact resources that you consider helpful, that would be appreciated.
Thanks!
Yes. If you have your custom UIView subclass instance inside a UIScrollView, your view controller just needs to set the UIScrollView to delay content touches and not allow it to cancel touch events.
[scrollView setCanCancelContentTouches:NO];
[scrollView setDelaysContentTouches:YES];
When the user taps and holds in the custom view, the event goes to that custom view, which can process the touch events to drag an item around, but if the user quickly swipes, it scrolls the view.
The "panel" view that you're referring to appears to be a UIPageControl view — although, perhaps, the specific incarnation of this view that Apple uses for the iPhone's home page may be customized.
Instances of generic UIView views that you might touch-and-drag will receive touch events. By overriding methods in the view, these events can be processed and passed to the page control, in order to tell it to "sweep" between pages.
If I wanted to do what you're asking about, that's how I might approach it. It seems doable to me, in any case.
Start with this: Swip from one view to the next view
Try using a UIButton that tracks the time since the state of the button changed to "highlighted". You may need to do this in order to track the dragging and move the button around:
Observing pinch multi-touch gestures in a UITableView
Check to see if the button starts overlapping one side of the screen while being dragged. If s certain amount of time elapses since the button first started overlapping the edge and then manipulate the UIScrollView so that it switches to the next page on the corresponding side of the screen
You may need to use NSTimer to keep track of how long the button is held down, etc.
In any case there's no reason why this couldn't work.
If UIButton doesn't work then perhaps try a custom subclass of UIControl (which tracks the same touch down actions etc.). If that doesn't work then use the window event intercept thing to track everything.

Adding a UIImage on a touch event iPhone

OK i am really struggling with this!
I know had to add an image to the view, i know how to record a touch event. But combining the two is proving to be an issue.
There are lots of tutorials out there on how to move an image with touch events.
But Could anyone suggest how i might complete the following:
Add an image to the view on touch
Add the same image on another touch received by the user.
Manipulate the location of the added images when the user touches a previously added image
Any advice would be highly appreciated
Supposing that you want to simply let the image appear and disappear, you could just implement the UITouch event handling methods in the UIViewController for the view that you want to intercept the touch events in. An example on how to do this can be found in the "iPhone Programming Guide: Event Handling" at:
http://developer.apple.com/IPhone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/EventHandling/EventHandling.html#//apple_ref/doc/uid/TP40007072-CH9
Once you have managed to intercept the touch events, you can simply add the UIImageView as a subview of the view you want it to appear in.
I hope that helped a bit.