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
url
grizzly
marie
postgresql-9.3
dronekit
arcgis
azure-database-mysql
x86-64
stdout
redhawksdr
msbi
ionic-native
apache-httpclient-4.x
fine-uploader
watson-dialog
openstack-horizon
amazon-data-pipeline
restructuredtext
vala
ppp
boosting
typeclass
angular-schema-form
ds-5
textview
restler
apache-falcon
machine-code
tunnel
strategy-pattern
word-wrap
sknode
ape-phylo
grails-2.0
amazon-fire-tv
logan-square
chrome-custom-tabs
azure-data-catalog
anonymous-function
hierarchical-clustering
opos
node-java
androiddesignsupport
dmalloc
grib
catalyst
esprima
lattice
timefield
eclipse-mars
netlink
weblogic-maven-plugin
treelist
trendline
bluetooth-lowenergy-4.2
videoview
ruby-1.8.7
biginsights
persian
personality-insights
jain-sip
roslyn-code-analysis
polarion
page-refresh
fileinputstream
esb-toolkit-2.1
genero
mri
backtrace
system.net
scjp
episerver-7
sigma-grid-control
nomachine
nsautoreleasepool
mail-gem
m3u
states
django-admin-tools
reflexil
socketasynceventargs
win-prolog
scriptmanager
httppostedfilebase
peoplepicker
gmagick
windows-xp-embedded
service-layer
cryptolicensing
hs-err
conditional-operator
simultaneous
dgml
lts
data-formats
high-load

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