UIWebView in UITableView reloads everytime I scrol

2019-09-04 12:12发布

Currently I have a UITableView that has a UIWebView in every cell. Each UIWebView is loading a unique embedded YouTube video. Is there a way to keep the UIWebView from reloading when scrolling. It looks cheaply developed when it scrolls on screen and is a white rectangle to loading a video thumbnail. I was looking into UIWebView caching but I don't know how I would go about caching the WebView to reuse it later.

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-09-04 12:25

You can try this differently, just define new table view cell for that particular index like

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil] retain];

see if that makes a difference you desire

查看更多
霸刀☆藐视天下
3楼-- · 2019-09-04 12:27

Keep a reference to the UITableViewCell somewhere (an array in your UITableViewController, for example), and return the existing cell in the cellForRowAtIndexPath call, instead of de-queueing a new cell.

查看更多
登录 后发表回答