简体   繁体   中英

Customized navigation controller toolbar is one pixel upper than the bottom of iPhone

I had to customize UIViewController and Used following codes to customize the UIViewController toolbar at the bottom

[self.navigationController.toolbar setBackgroundImage:[UIImage imageWithCGImage:[UIImage imageNamed:@"List/footer.png"].CGImage scale:2 orientation:UIImageOrientationDown] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
    [self.navigationController.toolbar setShadowImage:[UIImage imageNamed:@"transparent.png"] forToolbarPosition:UIToolbarPositionAny];
    [self.navigationController.toolbar setBackgroundColor:[UIColor clearColor]];

在此处输入图片说明

As it is obvious in screenshot picture there is one white pixel under the customized toolbar. How can I remove the pixel?

It is a simple answer but I have same situation lots of times :) Try to control image List/footer.png it can has 1px transparency bottom of itself?

Another situation is in iOS project I have never give a path like List/

Also my advice is if you want to give a shadow don't use image instead of this use QuartzCore framework and layer.shadow.

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