简体   繁体   中英

UIView Background Image with a Tab Bar & Navigation Bar

In my iPhone application I have the a Default.png image that appears when the app is loading. When my app is loaded the first view that appears is embedded in a Tab Bar Controller and a Navigation controller. I have an UIImageView on the first view that you see - basically I would like to keep it that the ImageView image stays in the exact same position as the default.png . When the view appears it is getting resized and moved up/down by the nav bar & tab bar, can I avoid that?

Is what I'm trying to achieve possible?

I hope my point is clear, it's kinda of awkward to explain.

I'm not quite sure what you're asking. Yes, any view that belongs to a tab bar controller or navigation controller will be resized to fit the remaining screen space, but you know exactly how much space your image view will have left after considering the space consumed by the other UI elements:

Status bar: 320 x 20 (portrait), 480 x 20 (landscape) Navigation bar: 320 x 44 (portrait), 480 x 34 (landscape) Tab bar: 320 x 49 (portrait), 480 x 49 (landscape)

So basically, you have the following available space for your image view:

Portrait: 320 x 367 Landspace: 480 x 217

Design your Default.png with those dimensions in mind. Honestly, the easiest way to match your first screen with your Default.png is to simply take a screenshot of the iOS Simulator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM