问题
After upgrading to xcode 5, I notice there is a flicker on the edge of the screen when transitioning between two screen. The flicker shows up as a vertical white line on the edge of the frame. This only appears to be happening on ios7.
The transition that I have between the two screens is via a storyboard segue.
UPDATE:
I fixed the issue by adding: self.view.clipsToBounds = YES; to my views.
回答1:
I figured out the issue. I had to set clipsToBounds
to YES
on my views. This fixes the problem.
回答2:
This issue comes in iOS7 when you try to update UI from background. So as to avoid above, you should update UI using GCD
Method as shown below.
dispatch_sync(dispatch_get_main_queue(), ^{
// Update UI (e.g. Alert, label changes etc)
});
or
dispatch_async(dispatch_get_main_queue(), ^{
// Update UI (e.g. Alert, label changes etc)
});
This will make sure to update in main queue.
回答3:
I had this issue with tableView Segues in iOS7 and the clipsToBounds BOOL did nothing for me. The fix for me was by loading my background image in viewDidAppear as opposed to viewDidLoad. example below:
- (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];
}
回答4:
Ok, I've solved the issue in my situation.
I had some custom UIView inside Container View. Container View had Background Color (probably I accidentally did this) set to White color. And between transitions I saw white line flickering (sometimes, randomly). When I set Container's View colour to Default, flickering on transitions disappeared.
来源:https://stackoverflow.com/questions/21574160/edge-flicker-when-transitioning-between-screens-ios7