If your use case permits, you can figure out the frame of the bar button item
in it's action selector by giving the selector the following signature:
- (void)barButtonAction:(UIBarButtonItem *)item event:(UIEvent *)event;
You can then use the properties of UIEvent to get the touches location, or the
view that the touches belong to.
For instance:
- (IBAction)barButtonAction:(UIBarButtonItem *)sender event:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
CGPoint locationInView = [[[event allTouches] anyObject]
locationInView:self.view];
NSLog(@"event touch location = %@", [NSValue
valueWithCGPoint:locationInView]);
NSLog(@"touch.view = %@", [touch view]);
}
On Sep 12, 2011, at 12:53 PM, Roland King wrote:
> I have a toolbar with items on it. One of them is a trash can. When I delete
> something from the main screen I'd like it to 'minify' towards the trash can,
> well I think I would, I have to see what it looks like and see if the effect
> is as nice as I hope, I want to draw attention to where the 'thing' has gone
> and this seems like a reasonable animation to try.
>
> However .. I can't figure out what the frame for the UIBarButtonItem is ..
> it's on a bar with items which change, some flexible space etc, so it's not a
> fixed offset from either end of the the thing, and I can't find an API which
> tells me what the frame is for a given item. Is there one I've missed?
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/jamiepinkham%40me.com
>
> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]