2012-01-06 21 views
0

私は2つのテーブルを持つビューを持っています。私はファイルの所有者の代わりに2つの異なるコントローラでこれらのテーブルのそれぞれを扱います。アプリは正しく読み込まれますが、「Under Featured」/ Storeテーブルをスクロールすると、EXC_BAD_ACCESSがスローされます。テーブルは保持されていないようです。私はウェブを上下に読んできましたが、原因を見つけることができません。EXC_BAD_ACCESSは1つのビューで2つのテーブルをスローします

XIB: enter image description here

UnderFeaturedViewController.h:

#import <UIKit/UIKit.h> 
#import "iMagsAppDelegate.h" 

@interface UnderFeaturedViewController : UIViewController <UITabBarDelegate, UITableViewDelegate, UITableViewDataSource> 
{ 
    IBOutlet UITableView *showTableView; 
    IBOutlet UITabBarItem *hotButton; 
    IBOutlet UITabBarItem *allButton; 
    IBOutlet UITabBarItem *catButton; 
    UIPopoverController *popoverController; 
    NSMutableArray *showArray; 
    iMagsAppDelegate *appDelegate; 
    UIInterfaceOrientation orientation; 
} 

@property (nonatomic, retain) IBOutlet UITableView *showTableView; 
@property (nonatomic, retain) IBOutlet UITabBarItem *hotButton; 
@property (nonatomic, retain) IBOutlet UITabBarItem *allButton; 
@property (nonatomic, retain) IBOutlet UITabBarItem *catButton; 
@property (nonatomic, retain) UIPopoverController *popoverController; 
@property (nonatomic, retain) NSMutableArray *showArray; 
@property (nonatomic, retain) iMagsAppDelegate *appDelegate; 

-(void) setTitle:(NSString *)title; 
-(void) setGuest; 
-(void) updateView:(NSNotification *)notification; 
-(void) dismissModalView:(int) modalID; 
-(Boolean) isGuest; 

-(IBAction) showTag:(NSString*)tag; 
-(IBAction) showName:(NSString *) name; 
-(IBAction) showStore; 
-(IBAction) showOwned; 
-(IBAction) showCategories; 
-(IBAction) showSearch; 
-(IBAction) showMore; 
-(IBAction) showFirstDialog; 

@end 

cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
    } 

    NSInteger section = [indexPath row]; 

    cell.textLabel.text = [NSString stringWithFormat:@"%d", section]; 

    return cell; 
} 

のゾンビ:

enter image description here

バックトレース:

#0 0x0182509b in objc_msgSend() 
#1 0x005afd18 in -[UIScrollView(UIScrollViewInternal) _scrollViewWillBeginDragging]() 
#2 0x005a31e9 in -[UIScrollView _updatePanGesture]() 
#3 0x005a74e6 in -[UIScrollView handlePan:]() 
#4 0x0081be39 in _UIGestureRecognizerSendActions() 
#5 0x0081b143 in -[UIGestureRecognizer _updateGestureWithEvent:]() 
#6 0x0081c3cf in -[UIGestureRecognizer _delayedUpdateGesture]() 
#7 0x0081ea31 in ___UIGestureRecognizerUpdate_block_invoke_0541() 
#8 0x0081e98c in _UIGestureRecognizerApplyBlocksToArray() 
#9 0x008173e7 in _UIGestureRecognizerUpdate() 
#10 0x0057f812 in -[UIWindow _sendGesturesForEvent:]() 
#11 0x0057fba2 in -[UIWindow sendEvent:]() 
#12 0x00566384 in -[UIApplication sendEvent:]() 
#13 0x00559aa9 in _UIApplicationHandleEvent() 
#14 0x017f5fa9 in PurpleEventCallback() 
#15 0x016361c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__() 
#16 0x0159b022 in __CFRunLoopDoSource1() 
#17 0x0159990a in __CFRunLoopRun() 
#18 0x01598db4 in CFRunLoopRunSpecific() 
#19 0x01598ccb in CFRunLoopRunInMode() 
#20 0x017f4879 in GSEventRunModal() 
#21 0x017f493e in GSEventRun() 
#22 0x00557a9b in UIApplicationMain() 
#23 0x00001e5d in main (argc=1, argv=0xbffff5f0) at ... 
+0

実際には、スーパーdeallocをコメントアウトするときに機能します。これは何を意味するのでしょうか? - (void)dealloc {// [super dealloc]; } –

+0

はあなたのコントローラのように見えますが、割り当て解除されますが、スクロールビューにはまだデリゲートとして表示されます。コントローラーはどこに残していますか? –

+0

あなたは '[super dealloc]'を呼び出さなければ解放されないので、それはもうゾンビではありません –

答えて

0

だからSplitViewControllerは、ビューではなくUnderFeaturedViewController

を保持ファイルの所有者/強いを作成するための参照IBOutletを保持でUnderFeaturedViewControllerので、SplitViewControllerはそれを保持します。

私は、UnderFeaturedViewControllerがどこでも保持されないので、次の実行ループで割り当てが解除されるという問題があると思います。

deallocにブレークポイントを設定して、いつ割り当てを解除するかを知ることができます。

関連する問題