首页 \ 问答 \ Nivo滑块不居中(Nivo Slider is not centered)

Nivo滑块不居中(Nivo Slider is not centered)

在此处输入图像描述 查看http://waterski.allthingswebdesign.com/index.php/site/index ,您可以看到我的Nivo滑块不在背景中心。 我无法弄清楚为什么会这样。 (忽略第2张和第3张照片,因为我知道它们的尺寸不正确,但第1张照片是正确的)。


enter image description hereCheck out http://waterski.allthingswebdesign.com/index.php/site/index and you can see that my Nivo Slider is not centered on the background. I can't figure out why this is. (ignore the 2nd and 3rd pictures as I know they are not the correct size, but the 1st one is).


原文:https://stackoverflow.com/questions/6681658
更新时间:2022-04-17 19:04

最满意答案

只是猜测:在插入第一张图像时,收藏视图可能尚未加载其数据。 但是,在异常消息中,集合视图声明“知道”插入之前的项目数量(1)。 因此,它可能在insertItemsAtIndexPaths:延迟加载其数据insertItemsAtIndexPaths:并将结果作为“之前”状态。 此外,插入后无需重新加载数据。

长话短说,移动了

[cv reloadData];

得到

if ([imageViews count] == 0)  {
    [self.noImagesLabel removeFromSuperview];
    [self.imageDisplayCell.contentView addSubview:cv];
    [cv reloadData];
}

Just a guess: at the time you are inserting the first image, the collection view may not yet have loaded its data. However, in the exception message, the collection view claims to "know" the number of items before the insertion (1). Therefore, it could have lazily loaded its data in insertItemsAtIndexPaths: and taken the result as "before" state. Also, you don't need to reload data after an insertion.

Long story short, move the

[cv reloadData];

up to get

if ([imageViews count] == 0)  {
    [self.noImagesLabel removeFromSuperview];
    [self.imageDisplayCell.contentView addSubview:cv];
    [cv reloadData];
}

相关问答

更多
  • VaporwareWolf提供的答案有点破解。 通过返回小尺寸而不是零尺寸,补充视图将始终存在,但尺寸太小而无法看到。 所以这就是它修复NSInternalInconsistencyException的原因 但是,有一个真正的解决方案 。 将数据添加到数据源并在调用insertItemsAtIndexPaths 之前 ,只需使collectionview上的布局无效,以使其知道更改。 Objective-C的 [self.collectionView.collectionViewLayout invalid ...
  • 当将第一个单元格插入到集合视图中时,遇到了同样的问题。 我通过更改我的代码来修复问题,以便调用UICollectionView - (void)reloadData 插入第一个单元格的方法,但是 - (void)insertItemsAtIndexPaths:(NSArray *)indexPaths 插入所有其他单元格时。 有趣的是,我也有一个问题 - (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths 删除最后一个单元格时。 我做了与之前相同的事 ...
  • 只是猜测:在插入第一张图像时,收藏视图可能尚未加载其数据。 但是,在异常消息中,集合视图声明“知道”插入之前的项目数量(1)。 因此,它可能在insertItemsAtIndexPaths:延迟加载其数据insertItemsAtIndexPaths:并将结果作为“之前”状态。 此外,插入后无需重新加载数据。 长话短说,移动了 [cv reloadData]; 得到 if ([imageViews count] == 0) { [self.noImagesLabel removeFromSupe ...
  • 您的performBlock保存时间过长。 您可以 只需保存在主线程上。 应该花费一瞬间来保存500本书,并且由于UI中没有任何重要的事情发生(用户在等待),因此无需在一个块中执行此操作。 请改用performBlockAndWait 。 只有在保存完成后才会更新表视图。 用户的结果与保存主线程非常相似。 使用NSFetchedResultsControllerDelegate而不进行块操作。 遵循Xcode提供的获取结果控制器模板。 这可能比仅保存主线程更慢,因为UI将获得多个更新。 Your perfo ...
  • 问题是在日志中说标题不能是nil.So在那里给出一些有效的输入,你可以避免崩溃。 就像标题部分不需要输入一样,给它一个clearclolor视图 要实现标头部分,必须实现以下数据源方法 - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)index ...
  • 该错误表示更改数据源时出现数据源问题。 可变字典中的键数不正确。 据推测,您使用NSIndexPath作为键和所需的数据作为值。 我认为使用数组更容易( indexPath.row会以正确的顺序指向正确的对象)。 检查更新方法,在其中更改数据源中的数据。 您应该确保您的词典包含预期的项目数。 在您的错误消息中,插入前后的1项似乎表明您的字典可能nil ,因此返回零计数。 确保您具有正确实例化的实例变量。 The error indicates a data source issue when changin ...
  • 在viewDidLoad()下的NextViewController.swift添加了以下两行: var nibName = UINib(nibName: "GalleryCell", bundle:nil) collectionView.registerNib(nibName, forCellWithReuseIdentifier: "CELL") 问题是我没有注册笔尖。 现在我正在这样做,它工作正常。 I added the following two lines in NextViewContro ...
  • 我相信问题与在不更新数据源的情况下从UITableView中删除项目时出现的问题相同,从而导致异常。 请尝试以下方法: [self.datasource removeObjectAtIndex:iPath.row]; //... delete the row from the collectionView. I believe that the problem is the same as the one that arises when you delete an item from a UITable ...
  • 凉! 最新版本的RxUI与UITableView, ReactiveTableViewSource类似。 我对NSInternalInconsistencyException也有一些棘手的问题: 如果您的任何更新都是重置,您需要忘记执行其他所有操作 如果应用程序在同一次运行中添加并删除了相同的项目,则需要检测并对其进行去抖(即甚至不告诉UIKit)。 当您意识到添加/删除可以更改索引范围而不仅仅是单个索引时,这会变得更加棘手。 Cool! The latest version of RxUI has a s ...
  • 它是否像这样,像一个魅力: [localCollectionView performBatchUpdates:^{ [localCollectionView insertItemsAtIndexPaths:indexPaths]; [localLabelCollectionView insertItemsAtIndexPaths:indexPaths]; } completion:^(BOOL finished) { hatching = NO; }]; 好像performBa ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。