nscollectionview


NSCollectionView with different item types


Accordingly Apple documentation I can use multiple item types in single NSCollectionView, but when I do it, I get a problem. I can't normally remove items.
A single collection view can support multiple item types, each with its own distinct appearance, and you can mix and match item types in the same collection view if you want.
My code snippet
- (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView
itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath {
NSInteger index = indexPath.item;
DataItem * item = [self.data itemAt:index];
if (item.type == ItemType1) {
TypeItemController1 * itemController = [collectionView makeItemWithIdentifier:#"TypeItemController1"
forIndexPath:indexPath];
[itemController updateWithIndex:index];
return itemController;
} else {
TypeItemController2 * itemController = [collectionView makeItemWithIdentifier:#"TypeItemController2"
forIndexPath:indexPath];
[itemController updateWithIndex:index];
return itemController;
}
}
-(void)collectionView:(NSCollectionView *)collectionView
removeItemsAt:(NSSet<NSIndexPath*>*) paths {
for (NSIndexPath * path in paths) {
[self.data removeItemAt:path.item];
}
[[collectionView animator] deleteItemsAtIndexPaths:paths];
}
If I have items with different types in my NSCollectionView and I have removed one of them, this item (removed) still displayed on the screen. I can't interact with it, but it displayed on the screen.
If all items have the same type, problem doesn't occur.
What I'm doing wrong?

Related Links

imac and mbp display nscollectionview different way
Why does NSCollectionView.makeItem sometimes crash with EXC_BAD_ACCESS?
NSCollectionView with different item types

Categories

HOME
indexing
botframework
stanford-nlp
typo3
stdout
nltk
arguments
xss
css-selectors
checkpoint
dcos
oms
mamp
hdf5
cakephp-2.0
swift3.1
popup
hapijs
project-reactor
conditional-formatting
orgchart
units-of-measurement
sphinx4
ds-5
tikz
ibm-bpm
mplab
availability
webmock
mkdir
motherboard
client-server
mybatis-generator
observer-pattern
rbac
encoder
text-formatting
g77
e4
perldoc
node-java
intermediate-language
sharpssh
richtext
nservicebus6
typewriter
multi-targeting
jtextarea
multi-select
zsh-completion
syslog4j
vitamio
db2-zos
mrunit
periodic-processing
ewam
event-tracking
play-json
random-sample
windows-phone-8-emulator
sparkcore
sicstus-prolog
screen-lock
autopep8
indices
caption
dojox.grid
atg-dynamo
cs193p
visual-studio-setup-proje
yandex-api
sigma-grid-control
slimscroll
fastcgi-mono-server
infor-eam
node-mongodb-native
ironworker
wpa
kademlia
blotter
libx264
tasklist
mail-gem
derived-class
django-1.4
sqlbuddy
facebook-winjs-sdk
s60
nscharacterset
ihtmldocument2

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App