Re: Simulate touch event with cordinate?
Re: Simulate touch event with cordinate?
- Subject: Re: Simulate touch event with cordinate?
- From: Chase Latta <email@hidden>
- Date: Fri, 01 Apr 2011 19:36:22 -0700
Are you trying to achieve something like, in the iBooks example, the
user can swipe their finger to change the page or press a 'next page'
button and have the same animation occur? If so then you need to
write one function to handle the animation and call that in response
to either a button push or a series of touch events.
- (void)moveMyThingFrom:(CGPoint)a toPoint:(CGPoint)b;
{
// Put code here for the animation
}
// For button press
- (IBAction)moveThingAcrossScreen:(id)sender;
{
CGPoint fromPoint = ...;
CGPoint toPoint = ...;
[self moveMyThingFrom:fromPoint toPoint:toPoint];
}
// For drag events you could do something like
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
{
lastPoint = ... // Value stored somewhere
CGPoint newPoint = ... // Calculated from event
[self moveMyThingFrom:lastPoint toPoint:toPoint];
}
The main point is that you should not be performing your animations in
your event handling code; this should be in separate methods that get
called from your event handling code or wherever you need to call it.
Is this what you were looking for?
Chase
On Fri, Apr 1, 2011 at 7:02 PM, Conrad Shultz
<email@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 4/1/11 6:44 PM, Rikza Azriyan wrote:
>> Sorry maybe you guys don't understand with my bad english..
>> I said UIGestureRecognizer does'n do what i want because it's for detecting/responding touch,gesture,tap etc that user did to the screen. It's for respond the user interaction to the screen...
>> In my case, i want to make that interaction. I want to make a touch event without touching the screen, i want to make slide event without touching it....
>
> Could you explain WHY you want to do this? Surely if your app takes a
> certain action in response to a gesture it would be easier to just
> trigger that action on demand.
>
> Don't know what your goal is, but at first read this sounds like the
> product of a very flawed application architecture.
>
>
> - --
> Conrad Shultz
>
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iD8DBQFNloOfaOlrz5+0JdURAmhwAJ9tvB7kMYsTq9oSeCNo0+Fm91/vHgCdGP4b
> 5+O28EP12Ej/qBFMsO5omys=
> =evPd
> -----END PGP SIGNATURE-----
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden