OK、それでここで私は再び恐ろしいことに直面していmessage sent to deallocated instance
ます...
- DMTabBar(基本的にはXcodeのようなTabBarコントロール)を使用しています
- ARCが有効になっている
さて、これが取引です:
- コントロールに付随する例は正常に機能します
- 私はゾンビを有効にしました(そして、Instrumentsを使用してデバッグを試みましたが、正直なところ、何を探すべきかわかりません)
deallocated
インスタンスはtabBarItems
、TabBar(さまざまなボタンをホストするもの)の配列です。
これは私がアイテムを追加する方法です:
NSMutableArray* sidebarItems = [@[
[DMTabBarItem tabBarItemWithIcon:[NSImage templateImageNamed:@"One" withSize:iconSize] tag:0 tooltip:@"Files"],
[DMTabBarItem tabBarItemWithIcon:[NSImage templateImageNamed:@"Two" withSize:iconSize] tag:1 tooltip:@"Explorer"],
[DMTabBarItem tabBarItemWithIcon:[NSImage templateImageNamed:@"Three" withSize:iconSize] tag:2 tooltip:@"Bookmarks"],
[DMTabBarItem tabBarItemWithIcon:[NSImage templateImageNamed:@"Four" withSize:iconSize] tag:3 tooltip:@"Search"]
] mutableCopy];
[sidebarTabs setTabBarItems:items];
// Handle selection events
[sidebarTabs handleTabBarItemSelection:^(DMTabBarItemSelectionType selectionType, DMTabBarItem *targetTabBarItem, NSUInteger targetTabBarItemIndex) {
if (selectionType == DMTabBarItemSelectionType_WillSelect) {
[sidebarTabView selectTabViewItem:[sidebarTabView.tabViewItems objectAtIndex:targetTabBarItemIndex]];
} else if (selectionType == DMTabBarItemSelectionType_DidSelect) {
}
}];
これは、さまざまな要素が宣言される方法です。
@interface myAppl : NSWindowController
{
IBOutlet DMTabBar* sidebarTabs;
IBOutlet NSTabView* sidebarTabView;
}
そしてこれはDMTabBar
のインターフェースです(最も「重要な」部分):
@interface DMTabBar : NSView {
}
// set an NSArray of DMTabBarItem elements to populate the DMTabBar
@property (nonatomic,strong) NSArray* tabBarItems;
// change selected item by passing a DMTabBarItem object (ignored if selectedTabBarItem is not contained inside tabBarItems)
@property (nonatomic,assign) DMTabBarItem* selectedTabBarItem;
私が間違っているのは何なのか説明してもらえますか?私は間違いなくメモリ管理の第一人者ではありませんが(そうです、勉強していることは認めます)、これで間違いなく自殺するつもりです...
私は設定しています、tabBarItems
そして彼らはそこにいるようです(少なくとも最初は)。なぜリリースされるのですか?(制御コードとプロジェクトコードの両方がARCを使用することを忘れないでください)。
何か案は?(他に何か知る必要がある場合に備えて、私に知らせてください...)