문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top