Question

One of those things that is probably trivial when you know the magic, which I don't. I want to know the x,y location and dimensions of the UIToolbar at the bottom of my iPhone screen (so that I can make sure whatever I do in the window above it, which is a video preview window, doesn't over lap the toolbar). But toolbars don't have a frame, so what to do?

I create the toolbar in the Storyboard and then drag a line over to .h file which creates this:

@property (retain, nonatomic) IBOutletCollection(UIToolbar) NSArray *mainToolBar;

So how do I go from this NSArray to something with a frame? Please note that I want this information on the toolbar itself, not the buttons within.

Thank you very much.

PS - I recognize that the toolbar is below the preview window and so it doesn't strictly apply in this case, but I'd like to know the answer for other cases.

Était-ce utile?

La solution

Create your outlet from here

enter image description here

Instead of creating from

enter image description here

And access your frame property

float y =  self.toolbar.frame.origin.y; like this
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top