【发布时间】:2014-02-05 10:09:08
【问题描述】:
升级到 xcode 5 后,我注意到在两个屏幕之间切换时屏幕边缘出现闪烁。闪烁显示为帧边缘的垂直白线。这似乎只发生在 ios7 上。
我在两个屏幕之间的转换是通过故事板转场实现的。
更新:
我通过添加以下内容解决了这个问题: self.view.clipsToBounds = YES; 我的看法。
【问题讨论】:
标签: ios objective-c ios7 xcode5 flicker
升级到 xcode 5 后,我注意到在两个屏幕之间切换时屏幕边缘出现闪烁。闪烁显示为帧边缘的垂直白线。这似乎只发生在 ios7 上。
我在两个屏幕之间的转换是通过故事板转场实现的。
更新:
我通过添加以下内容解决了这个问题: self.view.clipsToBounds = YES; 我的看法。
【问题讨论】:
标签: ios objective-c ios7 xcode5 flicker
我发现了这个问题。我必须在我的观点上将clipsToBounds 设置为YES。这解决了问题。
【讨论】:
当您尝试从后台更新 UI 时,iOS7 中会出现此问题。为了避免上述情况,您应该使用GCD 方法更新UI,如下所示。
dispatch_sync(dispatch_get_main_queue(), ^{
// Update UI (e.g. Alert, label changes etc)
});
或
dispatch_async(dispatch_get_main_queue(), ^{
// Update UI (e.g. Alert, label changes etc)
});
这将确保在主队列中更新。
【讨论】:
我在 iOS7 中遇到了 tableView Segues 的问题,而 clipsToBounds BOOL 对我没有任何帮助。对我来说,解决方法是在 viewDidAppear 中加载我的背景图像,而不是 viewDidLoad。下面的例子:
- (void)viewDidLoad
{
[super viewDidLoad];
tableData = [NSArray arrayWithObjects:@"First", @"Second", @"Third", nil];
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
UIEdgeInsets inset = UIEdgeInsetsMake(5, 0, 0, 0);
self.tableView.contentInset = inset;
//Don't load your background image or color here
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[[AppDelegate sharedInstance] setNavTitle:@"Title"];
//load your background image here
self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"FirstViewBackground"]];
self.tableView.backgroundColor = [UIColor clearColor];
}
【讨论】:
好的,我已经解决了我的情况。
我在 Container View 中有一些自定义 UIView。容器视图的背景颜色(可能我不小心这样做了)设置为白色。在过渡之间,我看到白线闪烁(有时是随机的)。当我将容器的视图颜色设置为默认值时,过渡闪烁消失了。
【讨论】: