Take the 2-minute tour ×

I have a UIToolbar in IB with a custom UIBarButtonItem that is set to an image. The image height is larger than the UIToolbar height. The image does not load for some reason. Attached is a screenshot.

enter image description here

share|improve this question
add comment

1 Answer

You should avoid using subviews that are larger than the parent view - even if it does work and draws the view outside of the bounds, you cannot always count on it because the clipping is skipped for performance reasons and depending on the drawing order the overlapping part of the subview might be covered later. Second problem is that only the part within the frame of the superview is able to handle the touch events.

As to why you don't see your image, it's probably a different problem, I doubt it has something to do with it going outside the frame. Post your code to get more feedback ;)

share|improve this answer
there is no code associated with my toolbar. All buttons and images are done in IB. The only code involved is my IBAction which should be unrelated to the image loading. –  Sheehan Alam Mar 14 '11 at 14:28
I see, and do you see the image in the IB ? Does it get copied to the target ? –  Tomas Vana Mar 14 '11 at 14:36
i do not see the image in IB. how do I copy it to the target? –  Sheehan Alam Mar 14 '11 at 15:43
expand the target in the XCode to see whether it's there and check whether you are referencing the file name correctly. If it's missing, add it to the target (i believe you can just drag it there, or set it up in the inspector while the file is selected) –  Tomas Vana Mar 14 '11 at 16:37
add comment

Your Answer


