UA-17470720-3

Jump to content


Photo
- - - - -

Stop SCTableViewController from flashing

view-controllers

  • Please log in to reply
4 replies to this topic

#1 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 11 March 2014 - 06:21 AM

Hi, I love this framework, but have a visual bug/issue that is driving me nuts

 

Please see this 5 sec movie: https://www.dropbox....eitj/Flashy.mov

 

I have a very simple core data model showing a bunch of Folders with Items: whenever a DetailViewController is pushed or popped, the tableview flashes....

 

(note: not "refreshes", the content is fine; but about a second after appearing it briefly flashes); both in simulator and on the device (iPhone 5S, iPad3, iPad mini; iOS 7.0.6; STV Pro 3.3)

 

Any pointers on preventing this - or at least understanding why it happens - would be greatly appreciated.

 

Dennis

 

 

 

 



#2 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 11 March 2014 - 02:24 PM

do you have any animations in the view? like to blur or something?

 

do u have any code in anything like viewWillAppear, didAppear things like that?

 

mine don't flash, so i am wondering what you have in your code


  • Dennis likes this

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#3 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 11 March 2014 - 05:58 PM

Hi Dennis,

 

I had an issue with a UIImageView in a SCCustomCell flashing when returning to the SCCustomCell from the detail view, something similar to what you're experiencing. I ended up editing the STV code and changing a load of UITableViewRowAnimationAutomatic to UITableViewRowAnimationNone.

 

More details here:

 

http://sensiblecocoa...om-detail-view/

 

and here:

 

 

 

http://sensiblecocoa...om-detail-view/

 

 

Not sure if this will apply in your case.


  • Dennis likes this
Cheers,

Dave

www.dgapps.ie

#4 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 11 March 2014 - 11:17 PM

do you have any animations in the view? like to blur or something?

 

do u have any code in anything like viewWillAppear, didAppear things like that?

 

mine don't flash, so i am wondering what you have in your code

 

Good suggestions, thanks. Indeed likely culprits.

 

I thought of those: completely disabled (plainly commented out) all viewWillAppear, viewDidAppear methods, as well as all xxxAppear Actions connected to sections, tableviews, view controllers, etc.

That killed some functionality, but regrettably did stop things from flashing.

 

Dennis



#5 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 11 March 2014 - 11:52 PM

Hi Dennis,

 

I had an issue with a UIImageView in a SCCustomCell flashing when returning to the SCCustomCell from the detail view, something similar to what you're experiencing. I ended up editing the STV code and changing a load of UITableViewRowAnimationAutomatic to UITableViewRowAnimationNone.

 

More details here:

 

http://sensiblecocoa...om-detail-view/

 

and here:

 

 

 

http://sensiblecocoa...om-detail-view/

 

 

Not sure if this will apply in your case.

 

Thanks! Found it:

 

Followed your suggestion and - for debugging sake - set all UITableViewRowAnimationAutomatic to UITableViewRowAnimationNone.

It did not change a thing. However, it was the right move: it turns out that upon returning from the detailviewcontroller, itemModified: is called on the re-appearing SCTableViewSection.

 

 (void)itemModified:(NSObject *)item
{
	if([SCUtilities isBasicDataTypeClass:[item class]])
    {
        // must reload array as item has been replaced (not modified)
        [self reloadBoundValues];
        [self items];
    }
    
    NSUInteger oldObjectIndex = [self.mutableItems indexOfObjectIdenticalTo:item];
    
    if(self.dataFetchOptions.sort)
        [self.dataFetchOptions sortMutableArray:self.mutableItems];
    
	NSUInteger modifiedObjectIndex = [self.mutableItems indexOfObjectIdenticalTo:item];
	
	if(modifiedObjectIndex != oldObjectIndex)
	{
		NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:modifiedObjectIndex 
													   inSection:self.selectedCellIndexPath.section];
        [self.ownerTableViewModel clearLastReturnedCellData];
		[self.ownerTableViewModel.tableView beginUpdates];
		[self.ownerTableViewModel.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.selectedCellIndexPath]
														 withRowAnimation:UITableViewRowAnimationLeft];
		[self.ownerTableViewModel.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]
														 withRowAnimation:UITableViewRowAnimationLeft];
		[self.ownerTableViewModel.tableView endUpdates];
		
		// update selectedCellIndexPath
		self.selectedCellIndexPath = newIndexPath;
	}
	
    // Update cell
    [self.ownerTableViewModel.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:self.selectedCellIndexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
    
	if(self.ownerTableViewModel.detailViewController)
	{
		[self.ownerTableViewModel.tableView selectRowAtIndexPath:self.selectedCellIndexPath animated:NO 
														 scrollPosition:UITableViewScrollPositionNone];
	}
}

 

Here, reloadRowsAtIndexPaths

 

// Update cell
[self.ownerTableViewModel.tableView reloadRowsAtIndexPaths
 

 

is called even is nothing has changed -> causing the flashing.

 

So, problem found.  

But now what? I could simply comment out the reloadRowsAtIndexPaths line, or surround it with an if clause.

 

However I want to stay far away from modifying STV code... going down that path, it will bite me in the future for sure. More importantly, STV requests just this single row to be reloaded and the real issue is in reloadRowsAtIndexPaths (as far as I can see; I don't know what is called downstream).

 

Dennis







Also tagged with one or more of these keywords: view-controllers

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users