I have webview in table view cell , whenever tableview cell is scrolling ,Web view reloads ....How to stop webview reload while tableview is scrolling.
Hi iOSDev please follow the following link
Don't reuse cell in UITableView
Max Pevsner solution fulfills your problem of not dequeuing the cell with just instantiating a table view cell.
But my suggestion is you use static webView, instead of not dequeuing the cell, as it will always stay in memory till the tableview is loaded, and moreover every time the cell will be created again when you will scroll the tableview. not dequeuing cell will be least efficient, for the tableview.
Related
i have table view for showing product detail and each part is tableview cell,
in one of my tableview cell that is showing sizes and stores that has that size like this
and
when the user click on one of collection view items tableview expand to show stores.
if i update root tableviewcell constraints i need to reload that cell
after reloading collection scroll will rest
i tried beginUpdates and endUpdates for root tableview after changing constraint it will work but in some situation it will show a blank cell
what's wrong in my idea
in summary :
how to expand tableview cell without reloading and refresh cell view .i think both questions are equal
Change the constraints in the tableView and add to model the currently selected collectionViewCell and scroll to it with no animation in collectionViewCell awakeFromNib method the default value is 0 which means no animation will happen [the model I mean here is the model of the tableView from which you display every tableViewCell]
I'm building a chat interface. I'm using multiple types of tableView cells in UITableView. Table view cells are start flickering when new cell is added into tableView from reusablecell. I'm dequeuing tableview cells with following piece of code. How get scrolling smooth with out any flickering.
tableView.dequeueReusableCellWithIdentifier("MessageLessonTableViewCell") as! MessageLessonTableViewCell
The main reason for flickering is that, tableView is getting data to be attached late in time. So when you scroll, it takes time to switch from one type of tableViewCell to another. Plus you might be doing DB operations in cellForRowAtIndexPath which delays in returning tbaleViewCell. For implementing Smooth scrolling refer this
I have a UITableView with custom cells,those cells contain some textFields,segmented index and all.Once i entered the data in particular cell textfield and segmented index after that i scrolled the tableview data contents disappears and overlapping.Can anyone tell me how to resolve the issue and how should i code.
Use IBOutlet in UITableViewCell because if you create segmented control,textfield as subviews after scrolling down they will be added as subviews every time you Scroll.
I want to scroll a UITableView cell by cell (like the date picker, for example), so that the first visible row is always displayed entirely. How can I do that?
Use the scroll view delegate method scrollViewWillEndDragging:withVelocity:targetContentOffset: (your table view delegate is already the scroll view delegate) so that you can inspect the proposed targetContentOffset and modify it to ensure that the target first row is fully visible.
I have an application with a UICollectionView with horizontal scroll of cells (Only one cell is displayed at a time). Each cell hosts a UITableView which displays content (URL links) in each of the UITableViewCell.
The problem is that the first two cells of UICollectionView display the proper content, but starting from the third cell, the contents are displayed from the dequeued cells. The correct content on the dequeued cell's UITableView is only displayed if user scrolls down and then scrolls up to the top.
For example, the contents of the third cell are the content from the first cell.
The cell is a custom UICollectionViewCell that hosts the UITableView. The custom cell implements the UITableViewDataSource, UITableViewDelegate.
I have searched through different forums and sites and found the solution of refresh.
I tried adding the [collectionView reload] to the -cellForItemAtIndexPath: method, but it goes into constant loop. I know that is not the right place, but i do not have any other methods that cause the refresh (only scrolling through the cells loads the next cell's content).
Can somebody please help me to resolve the issue?
You are missing some facts about dequeuing.
When you 3d custom UICollectionViewCell is dequeued, it isn't allocated like when it's displayed for the first time. Instead, your collection view "reuses" 1st cell for displaying 3d. The best moment to clear content in your custom cell class is -(void)prepareForReuse. If you override it and clear it's content, the -cellForItemAtIndexPath: will dequeue "clear" cell which you can further customize.
However, i don't exactly know how to "clear" the tableView, not sure whether it's possible. You have to reloadData on your tableView in -cellForItemAtIndexPath:. Example:
- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView cellForItemAtIndexPath:(NSIndexPath*)indexPath
{
MyCVCell *cell = [collectionView dequeueReusableCellWithIdentifier:#"MyCVCell" forIndexPath:indexPath];
cell.arrayOfURLsForDisplay = self.arrayOfArraysOfURLs[indexPath.row];
[cell.tableView reloadData];
return cell;
}
Here i mean you have some arrayOfArraysOfURLs in your viewController and you dislay URLs in your custom cell from some arrayOfURLsForDisplay
I had similar problem, instead of using [cell.tableView reloadData] inside the cellForItemAtIndexPath, I called collectionView.reloadData in the prepareForUse method that is overwritten in your custom UITableviewCell