custom right bar button item in ios6 is not transparent

这一生的挚爱 提交于 2019-12-04 17:49:49
Chris Ostmo

I know this is an old thread, but I had the same issue, and thought you might be interested in what I discovered.

A work-around is available in this thread (the answer by jd, not the "accepted" answer).

You should be able to get the behavior you want with this code:

const float colorMask[6] = {222, 255, 222, 255, 222, 255};
UIImage *img = [[UIImage alloc] init];
UIImage *maskedImage = [UIImage imageWithCGImage: CGImageCreateWithMaskingColors(img.CGImage, colorMask)];

[tools setBackgroundImage:maskedImage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];

Although this works, I am not convinced that it is the correct way to do it, so I started a new thread here in case anyone knows the secret code for making a UIToolbar containing rectangle behave as a transparent object should.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!