草庐IT

uiCollectionView

全部标签

iphone - 检测滚动 UICollectionView 的方向,从 REST 加载数据

假设标准配置(向上/向下),我想检测用户何时向上或向下滚动他们的UIColletionView(它是UIScrollView的子类并符合到UIScrollViewDelegate)。我没有直接从委托(delegate)中看到任何信息来检测这一点,尽管我可能看得太过头了。如果我知道用户正在滚动哪个方向,那么我可以使用这些UICollectionViewDatasource方法来确定我是否应该从REST服务器加载更多数据,或者清除我已经必须管理的固定信息内存空间。//如果向下滚动,出现部分-(UICollectionReusableView*)collectionView:(UIColle

ios - UICollectionView insertItemsAtIndexPaths : throws exception

UICollectionView:我做错了。我只是不知道如何。我的设置我在装有iOS6.0.1的iPhone4S上运行它。我的目标我有一个TableView,其中一个部分专门用于图像:当用户点击“添加图像...”单元格时,系统会提示他们从照片库中选择图像或使用相机拍摄新图像。应用程序的那部分似乎运行良好。当用户第一次添加图像时,“NoImages”标签将从第二个表格单元格中移除,并在其位置添加以编程方式创建的UICollectionView。该部分似乎也工作正常。CollectionView应该显示他们添加的图像,而这正是我遇到麻烦的地方。(我知道我将不得不跳过一些障碍,让表格View

iOS——缺少将自定义 UICollectionViewCell 添加到 UICollectionView 的内容

我正在尝试定义我自己的自定义UICollectionViewCell实现并在UICollectionView中使用它。这是我所做的。1-我正在使用Storyboard。2-我向另一个View添加了一个UICollectionView,那是Storyboard上的一个场景。3-我将集合的datasource和delegate指向场景的Controller。4-我在Controller中提供了所需方法的实现。5-我创建了一个单元格View.h和.m文件。在.h文件中我做@interfaceHscCellView:UICollectionViewCell6-我创建了一个新View,所以我得到

ios - 具有动态单元格内容的 UICollectionView - 让单元格记住状态

我有一个包含动态内容的UICollectionView。我遇到的问题是,当单元格dequeued时,它忘记了它的状态。在我的-(UICollectionViewCell*)collectionView:(UICollectionView*)collectionViewcellForItemAtIndexPath:(NSIndexPath*)indexPath我有一个bool值,当它为真时,它会变成真实的图像,但当它是false,它变成一个假图像。但是,当我向下滚动并向上滚动时,细胞会忘记那里的状态。有没有办法让细胞记住它的状态?这是我里面的东西-(UICollectionViewCel

ios - UICollectionView 中的动画滚动到项目并不总是有效

问题我想让UICollectionView对特定项目进行动画滚动。这在大多数情况下都有效,但偶尔我尝试滚动到的项目最终没有显示。代码-(void)onClick{//(Possiblyrecomputethe_itemsarray.)NSIntegertarget_idx=//(...somevalidindexof_items)NSIndexPath*item_idx=[NSIndexPathindexPathForItem:target_idxinSection:0];[selfscrollToItem:item_idx];}-(void)scrollToItem:(NSIndex

ios - UICollectionView 重用单元格问题

我对CollectionView单元格有疑问。当我的CollectionView首次加载时,它会显示如下项目:-(UICollectionViewCell*)collectionView:(UICollectionView*)cvcellForItemAtIndexPath:(NSIndexPath*)indexPath;{CalendarCell*cell=[cvdequeueReusableCellWithReuseIdentifier:@"CalendarCell"forIndexPath:indexPath];[cellbindDate:_datesMgr.currentMon

ios - UICollectionView-如何删除第一个单元格上方的间距?

UICollectionView-如何移除第一个单元格上方的间距?我的顶部插图=0,行=10-(CGSize)collectionView:(UICollectionView*)collectionViewlayout:(UICollectionViewLayout*)collectionViewLayoutsizeForItemAtIndexPath:(NSIndexPath*)indexPath{if(indexPath.row==0){returnCGSizeMake(collectionView.width,44);}returnCGSizeMake(300,150);}-(U

ios - 如何以编程方式更改 UICollectionView 的大小?

我在界面生成器中创建了一个UICollectionView。我用引用了它@property(strong,nonatomic)IBOutletUICollectionView*contactList;在我的.h文件和@synthesizecontactList中;在我的.m文件中。我尝试使用以下代码在纵向和横向中实现略有不同的布局:-(void)adjustViewsForOrientation:(UIInterfaceOrientation)orientation{if(orientation==UIInterfaceOrientationPortrait||orientation=

iphone - 在 UICollectionView 中创建被子布局

我需要这种类型的UICuollectionView。每个单元格都有一个图像和一个标签。单元格的高度和宽度取决于该标签的文本。-(UICollectionViewCell*)collectionView:(UICollectionView*)cvcellForItemAtIndexPath:(NSIndexPath*)indexPath{CollectionViewCell*cell=[cvdequeueReusableCellWithReuseIdentifier:@"kCellID"forIndexPath:indexPath];if(cell==nil){cell=[[[NSBun

ios - UICollectionView 窃取焦点

我有一个UICollectionView,它带有一个页眉、一些单元格和一个页脚补充View。header包含一个UISearchBar。如果我在搜索字段中输入内容,键盘会在输入第一个字母后自动消失。我认为这是由我的-searchBar:textDidChange:引起的,它包含用于刷新CollectionView的代码(通过-reloadData,因为这是我知道的唯一有效的方法).我的理论是,重新加载UICollectionView会使其成为第一响应者,但不知何故不起作用。每次键盘关闭时,我的输出中都会有这一行:settingthefirstresponderviewofthecoll