背景
我搜索了SO和苹果论坛.相当多的人谈到了带图像的集合视图单元的性能.他们中的大多数人表示,由于在主线程中加载图像,因此滚动滞后.
通过使用SDWebImage,图像应该在单独的线程中加载.但是,它仅在iPad模拟器中的横向模式下滞后.
问题描述
在纵向模式下,集合视图为每行加载3个单元格.它没有滞后或微不足道的延迟.在横向模式下,集合视图为每行加载4个单元格.并且它具有明显的滞后和帧速率下降.
我已经使用带有核心动画的乐器工具进行了检查.出现新单元格时,帧速率降至约8fps.我不确定哪种行为会给集合视图带来如此低的性能.
希望有人知道这个技巧部分.
这是相关代码
在视图控制器中
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
ProductCollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"ProductViewCell" forIndexPath:indexPath];
Product *tmpProduct = (Product*)_ploader.loadedProduct[indexPath.row];
cell.product = tmpProduct;
if (cellShouldAnimate) {
cell.alpha = 0.0;
[UIView animateWithDuration:0.2
delay:0
options:(UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
animations:^{
cell.alpha = 1.0;
} completion:nil];
}
if(indexPath.row >= _ploader.loadedProduct.count - ceil((LIMIT_COUNT * 0.3)))
{
[_ploader loadProductsWithCompleteBlock:^(NSError *error){
if (nil == error) {
cellShouldAnimate = NO;
[_collectionView reloadData];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
cellShouldAnimate = YES;
});
} …Run Code Online (Sandbox Code Playgroud) 目前我正在实施一个网站的移动版本。
在 iOS 7.1 safari或UIWebView 上,它显示

但是我的预期输出是(在android 浏览器上也是正确的)

你可以看到文本框的上部在 iOS 上有一个内部阴影。
我所做的是将box-shadow设置为none。然而,阴影依然存在。
有人对这个问题有想法吗?
这是 CSS 代码
input, textarea {
box-shadow: none;
background-color: transparent;
border: 1px solid #EEE;
}
Run Code Online (Sandbox Code Playgroud)