• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: any way to know where a UIBarButtonItem has been drawn?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: any way to know where a UIBarButtonItem has been drawn?


  • Subject: Re: any way to know where a UIBarButtonItem has been drawn?
  • From: Jamie Pinkham <email@hidden>
  • Date: Mon, 12 Sep 2011 14:47:15 -0400

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@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

  • Follow-Ups:
    • Re: any way to know where a UIBarButtonItem has been drawn?
      • From: Rick Mann <email@hidden>
    • Re: any way to know where a UIBarButtonItem has been drawn?
      • From: Roland King <email@hidden>
References: 
 >any way to know where a UIBarButtonItem has been drawn? (From: Roland King <email@hidden>)

  • Prev by Date: Re: Problem with NSAppleScript execution
  • Next by Date: web view moving in split view when keyboard comes up
  • Previous by thread: Re: any way to know where a UIBarButtonItem has been drawn?
  • Next by thread: Re: any way to know where a UIBarButtonItem has been drawn?
  • Index(es):
    • Date
    • Thread