在这里,我们将给大家分享关于objective-c–NSIndexSet“-indexAtIndex:”?的知识,同时也会涉及到如何更有效地-[__NSCFArrayinsertObject:atIn
在这里,我们将给大家分享关于objective-c – NSIndexSet“-indexAtIndex:”?的知识,同时也会涉及到如何更有效地-[__NSCFArray insertObject:atIndex:]: mutating ...、cellForItemAtIndexPath,sizeForItemAtIndexPath,insetForSectionAtIndex未被调用iOS、CI框架去除indexphp excel index index finger z index、com.android.dex.DexIndexOverflowException: Cannot merge new index 66299 into a non-jumbo instruction的内容。
本文目录一览:- objective-c – NSIndexSet“-indexAtIndex:”?
- -[__NSCFArray insertObject:atIndex:]: mutating ...
- cellForItemAtIndexPath,sizeForItemAtIndexPath,insetForSectionAtIndex未被调用iOS
- CI框架去除indexphp excel index index finger z index
- com.android.dex.DexIndexOverflowException: Cannot merge new index 66299 into a non-jumbo instruction
objective-c – NSIndexSet“-indexAtIndex:”?
说我想用NSIndexSet表示一组稀疏的索引(这当然是这样).我可以使用-firstIndex来获得最低的一个,而-lastIndex是最高的,但是在给定其“索引”的情况下,在中间获得单个任意索引的规范方法是什么?文件让我不清楚.
例如.如果我有一个索引设置索引{0,5,8,10,12,28},我想说“给我第四个索引”,我希望得到10(或12我想依赖关于我是否计数第零,但是我们不介意,你知道我的意思).
请注意,我没有在整个索引集中进行“枚举”.在给定的时间点,我只想知道集合中的第n个索引是按数字顺序排列的.
也许我的数据结构是错误的(“set”通常不是为这种有序的访问而设计的),但似乎没有NSIndexArray可以说.
我错过了什么吗?
谢谢!
解决方法
NSUInteger index = [indexSet firstIndex]; for (NSUInteger i = 0,target = 4; i < target; i++) index = [indexSet indexGreaterThanIndex:index];
那应该给你第四个索引.如果需要,您甚至可以将方法添加为类别方法:
- (NSUInteger)indexAtIndex:(NSUInteger)anIndex { if (anIndex >= [self count]) return NSNotFound; NSUInteger index = [indexSet firstIndex]; for (NSUInteger i = 0; i < anIndex; i++) index = [self indexGreaterThanIndex:index]; return index; }
但是,正如你所说,这可能不是最好的数据结构使用,所以在考虑这样的事情之前,请考虑更多.
-[__NSCFArray insertObject:atIndex:]: mutating ...
NSMutableArray对象插入的时候碰到的一个问题
原先大代码差不多是这样的。
NSMutableArray *dataList = [[NSMutable alloc]init];//这个是全局变量,程序加载的时候已经对它初始化
然后加载更多的时候通过解析方法获得了一个array
NSMutableArray *array = [self parseResult];
原先使用:[self.dataList addObjectsFromArray:array];报错
后改为
NSMutableArray *array = [self parseResult];
NSMutableArray *tempArray = [[NSMutable alloc]init];
[tempArray addObjectsFromArray:self.dataList];
for(NSDictionary *dic in array){
[temp addObject:dic];
}
self.dataList = tempArray;
运行没问题了
PS:我是使用ARC的
cellForItemAtIndexPath,sizeForItemAtIndexPath,insetForSectionAtIndex未被调用iOS
单元的标识符是photoCell,类是JLTPhotoCell.
- (void)viewDidLoad { [super viewDidLoad]; _thumbNails = [[NSArray alloc]init]; // its declared,don't worry about this _thumbNails = [[LADataModelController getSingleton] getAllSignatures]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; [layout setItemSize:( CGSizeMake(50,50))]; [_collectionView setCollectionViewLayout:layout]; self.collectionView.delegate = self; self.collectionView.dataSource = self; [_collectionView registerClass:[JLTPhotoCell class] forCellWithReuseIdentifier:@"photoCell"]; [self.view addSubview:self.collectionView]; self.collectionView.allowsSelection = true; } - (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section { NSLog(@"count %i",_thumbNails.count); return _thumbNails.count; } - (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView { return 1; } - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (_thumbNails.count > 0) { JLTPhotoCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"photoCell" forIndexPath:indexPath]; NSData *thumbnailData = ((LASignature*)[_thumbNails objectAtIndex:indexPath.row]).signatureImage; UIImage* thumbnailImage = [UIImage imageWithData:thumbnailData]; [cell setThumbnail:thumbnailImage]; NSLog(@"image:%@",thumbnailImage); if (!_buttonSelect.hidden) { [cell performSelected:FALSE]; } return cell; } return nil; } #pragma mark UICollectionViewDelegate Methods -(void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { _lastSelectedSign = [_thumbNails objectAtIndex:indexPath.row]; if (!self.buttonSelect.hidden) { JLTPhotoCell *cell = (JLTPhotoCell *)[_collectionView cellForItemAtIndexPath:indexPath]; cell.selected = FALSE; } else { [_selectedImages addobject:[_thumbNails objectAtIndex:indexPath.row]]; JLTPhotoCell *cell = (JLTPhotoCell *)[_collectionView cellForItemAtIndexPath:indexPath]; [cell performSelected:TRUE]; // _buttonDelete.enabled = _selectedImages.count > 0; } } -(void) collectionView:(UICollectionView *)collectionView diddeselectItemAtIndexPath:(NSIndexPath *)indexPath { [_selectedImages removeObject:[_thumbNails objectAtIndex:indexPath.row]]; JLTPhotoCell *cell = (JLTPhotoCell *)[_collectionView cellForItemAtIndexPath:indexPath]; [cell performSelected:FALSE]; _buttonDelete.enabled = _selectedImages.count > 0; } #pragma mark - UICollectionViewDelegateFlowLayout -(CGSize) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeforItemAtIndexPath:(NSIndexPath *)indexPath { return CGSizeMake(50,50) ; } -(UIEdgeInsets) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewFlowLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { collectionViewLayout.minimumInteritemSpacing=1; collectionViewLayout.minimumLinespacing =2; return UIEdgeInsetsMake(1,1,1); } jltPhotoCell Class -(void) setThumbnail:(UIImage *) thumbnail { [self setThumbnail:thumbnail andWithSize:(CGSizeMake(50,50))]; } -(void) setThumbnail:(UIImage *) thumbnail andWithSize:(CGSize) size { UIImageView *thumbImageView = [[UIImageView alloc] initWithImage:thumbnail]; thumbImageView.frame = CGRectMake(0,size.width,size.height); thumbImageView.userInteractionEnabled = YES; [self.contentView addSubview:thumbImageView]; } -(void) performSelected:(bool)selected { if (selected) { UIImageView *deleteImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"delete"]]; deleteImageView.frame = CGRectMake(self.contentView.frame.size.width - 35,3,32,32); deleteImageView.tag = 123; [self.contentView addSubview:deleteImageView]; } else { UIView *v = [self.contentView viewWithTag:123]; v.hidden = YES; [self.contentView bringSubviewToFront:v]; [v removeFromSuperview]; } }
任何建议将不胜感激.谢谢.
解决方法
但是,在数据源工作之后分配代理.
我变了:
self.collectionView.delegate = self; self.collectionView.dataSource = self;
有:
self.collectionView.dataSource = self; self.collectionView.delegate = self;
CI框架去除indexphp excel index index finger z index
转自:http://zhidao.baidu.com/link?url=vmpvphh36efxqgr65dit9hvmolh_kha333fceqk_vqibyvxrxm0weewsllfsv-8oenpcbt31yosgfgqtxhvcwczivukbyfadb_jgndmskdu
正文:
<span>apache环境下: 通过 .htaccess 文件来设置一些简单的规则删除它。下面是一个例子,使用“negative”方法将非指定内容进行重定向: RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] 如果你的项目不在根目录请把上面这一句改为:RewriteRule ^(.*)$ index.php/$1 [L] 在上面的例子中,可以实现任何非 index.php、images 和 robots.txt 的 HTTP 请求都被指向 index.php。 Nginx环境下: 修改nginx配置文件,在SERVER段中添加如下代码: location /{ if (-f $request_filename) { expires max; break; } if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } }</span>
以上就介绍了CI框架去除indexphp,包括了index方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
com.android.dex.DexIndexOverflowException: Cannot merge new index 66299 into a non-jumbo instruction
打包时控制台输出:
Error:Execution failed for task '':app:transformClassesWithDexForAll32Release''.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: Cannot merge new index 66676 into a non-jumbo instruction!
在主工程的build.gradle文件,android{} 内添加如下内容
android.dexOptions {
jumboMode = true
// javaMaxHeapSize "2g"
}
Eclipse 中是在project.properties中添加dex.force.jumbo=true
今天关于objective-c – NSIndexSet“-indexAtIndex:”?的分享就到这里,希望大家有所收获,若想了解更多关于-[__NSCFArray insertObject:atIndex:]: mutating ...、cellForItemAtIndexPath,sizeForItemAtIndexPath,insetForSectionAtIndex未被调用iOS、CI框架去除indexphp excel index index finger z index、com.android.dex.DexIndexOverflowException: Cannot merge new index 66299 into a non-jumbo instruction等相关知识,可以在本站进行查询。
本文标签: