Вопрос

Любая помощь, которую вы можете предложить, будут оценены.

У меня есть приложение, в котором есть табличка, подробное представление, FlipView и Moredetail. Это хорошо движется через переходы до 26-го элемента. Приложение вылетает, когда я ударю кнопки, которые переходят к флиску и MoredetailView.

Мне дают ошибку MSG: [NSIndexPath row] message sent to deallocated instance.

Я думаю, что я могу называть индекс слишком много раз, но почему все работает до 25-го элемента, а затем перестанет работать? Как NsindexPath будет рассмотрена? Я никогда не оформлен.

Если вы знаете, пожалуйста, помогите. Спасибо!!!

Xcode говорит, что проблема здесь:

@implementation produceView aka *detailView*

- (IBAction)showInfo {

        FlippedProduceView *fView = [[FlippedProduceView alloc]initWithIndexPath:index];
    fView.flipDelegate = self;


    fView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:fView animated:YES];
         [fView release]; 

}


 - (IBAction) buttonPushed:(id)sender

{

    picView *pictureView = [[picView alloc]initWithIndexPath:index];


    pictureView.picDelegate = self;
    pictureView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;     

    [self presentModalViewController:pictureView animated:YES];
        [pictureView release];
}

-(id)initWithIndexPath:(NSIndexPath *)myIndexPath {   
if (self == [super init]) {
            path = myIndexPath;

    }
    return self;

}

@implementation picView aka *moreDetailView*

- (void)viewDidLoad {
    RipeGuideAppDelegate *AppDelegate = (RipeGuideAppDelegate *)[[UIApplication sharedApplication] delegate];
    self.picViewArray = AppDelegate.arrayProduceInfo;

    NSMutableDictionary *dictionary = [picViewArray objectAtIndex:path.row];
}

@implementation FlippedProduceView aka *flipView*


- (id)initWithIndexPath:(NSIndexPath *)myIndexPath {
    if (self == [super init]) {
        indexes = myIndexPath;
    }
    return self;
}

- (void)viewDidLoad {
    RipeGuideAppDelegate *AppDelegate = (RipeGuideAppDelegate *)[[UIApplication sharedApplication] delegate];
    self.flipViewArray = AppDelegate.arrayProduceInfo;

    NSMutableDictionary *dictionary = [flipViewArray objectAtIndex:indexes.row];
}
Это было полезно?

Решение

Вы должны использовать свойства (@property (retain) NSIndexPath *path;) вместо переменных экземпляров, поэтому тогда, когда вы делаете self.path = myIndexPath Затем он поднимает укладку, поэтому он не будет освобожден, когда IndexPath AutoReaDed.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top