比较两个截图:酒吧半透明的的iOS 7.0.3了
完成在iOS 7.0模拟器
而且一个在iOS 7.0.3 iPhone 4S做:
相同的代码在这里,那里和相同的东西!任何想法为什么半透明性在真实设备上消失了?
我有这样的代码来模拟它(我知道这可能是尴尬的,不正确的,但是这就是它是):
topMenuView = [[UIView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, 0, self.view.frame.size.width, TOP_BAR_ORIG_HEIGHT)];
topMenuView.clipsToBounds = YES;
UIToolbar *topMenuViewBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, -4, self.view.frame.size.width, TOP_BAR_ORIG_HEIGHT + 4)];
topMenuViewBar.barStyle = UIBarStyleDefault;
topMenuViewBar.barTintColor = [BSFunctions getColorFromHex:@"1ea6ff"];
const CGFloat statusBarHeight = 20;
UIView *underlayView = [[UIView alloc] initWithFrame:CGRectMake(0, -statusBarHeight, topMenuViewBar.frame.size.width, topMenuViewBar.frame.size.height + statusBarHeight)];
[underlayView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
[underlayView setBackgroundColor:[BSFunctions getColorFromHex:@"1ea6ff"]];
[underlayView setAlpha:0.36f];
[topMenuViewBar insertSubview:underlayView atIndex:1];
UIView *underlayView2 = [[UIView alloc] initWithFrame:CGRectMake(0, -statusBarHeight, topMenuViewBar.frame.size.width, topMenuViewBar.frame.size.height + statusBarHeight)];
[underlayView2 setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
[underlayView2 setBackgroundColor:[BSFunctions getColorFromHex:@"0291ff"]];
[underlayView2 setAlpha:0.36f];
[topMenuViewBar insertSubview:underlayView2 atIndex:2];
[topMenuView addSubview:topMenuViewBar];
[self.view addSubview:topMenuView];
主要的一点是它使用在设备上之前的工作!但iOS 7.0.3出来后,它发生了变化。我注意到Facebook和Fitocracy iOS应用中的相同行为。
UPDATE
上的Xcode 5.0.1与iOS 7.0.3模拟器,我们有这个(这是在iOS 7.0模拟器,你可以看到第一个图像不同):
您是否关闭了iPhone中的辅助功能和动作? – Fogmeister
正如Fogmeister建议的那样,请检查[辅助功能>增加对比度]的设置(http://www.macworld.com/article/2048738/get-to-know-ios-7-changes-in-the-settings-app.html ),这会降低半透明度。 –
@Fogmeister不,没有任何改变。我认为模拟器上没有这样的选项。 –