0

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

1 Answer 1

0

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 ;)

4
  • 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. Mar 14, 2011 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, 2011 at 14:36
  • i do not see the image in IB. how do I copy it to the target? Mar 14, 2011 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, 2011 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.