PSMTabBarControl その3
PSMTabBarControl.mのtabViewDidChangeNumberOfTabViewItems:内に問題を発見。
NSArray *tabItems = [tabView tabViewItems]; // go through cells, remove any whose representedObjects are not in [tabView tabViewItems] NSEnumerator *e = [_cells objectEnumerator]; PSMTabBarCell *cell; while(cell = [e nextObject]){ if(![tabItems containsObject:[cell representedObject]]){ [self removeTabForCell:cell]; } }
これ、removeTabForCell:内で_cellsいじってるので、「Enumerateしてんのに変更するんじゃねえよ」エラーが出ます。
NSArray *tabItems = [tabView tabViewItems]; // go through cells, remove any whose representedObjects are not in [tabView tabViewItems] NSEnumerator *e = [[[_cells copy] autorelease] objectEnumerator]; PSMTabBarCell *cell; while(cell = [e nextObject]){ if(![tabItems containsObject:[cell representedObject]]){ [self removeTabForCell:cell]; } }
多分これでいいんじゃないだろうか。