在屏幕之间过渡iOS7时的边缘闪烁



升级到Xcode 5后,我注意到在两个屏幕之间过渡时,屏幕边缘上有一个闪烁。闪烁显示为框架边缘的垂直白线。这似乎仅在ios7上发生。

我在两个屏幕之间的过渡是通过情节板进行的。

更新:

我通过添加:self.view.clipstobounds = yes;对我的观点。

我发现了问题。我必须在视图上将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];

}

好吧,我已经解决了问题。

我在容器视图中有一些自定义的Uiview。容器视图的背景颜色(可能是我意外这样做)设置为白色。在过渡之间,我看到白线闪烁(有时是随机)。当我将容器的视图颜色设置为默认时,过渡上的闪烁就消失了。

最新更新