使用Delegate方法的CustomCell崩溃了我的应用程序

时间:2013-12-01 19:28:15

标签: ios uitableview delegates tableview parse-platform

我的应用使用parse.com,我创建了一个包含委托的自定义单元格。

FFCustomCellWithImage.h:

@ class FFCustomCellWithImage;
@ protocol FFCustomCellWithImageDelegate <NSObject>

- (Void) cellaImmagine: (FFCustomCellWithImage *) cellaImmagine userPressedGoPointButtonAction: (UIButton *) goPointButton goPointObject: (PFObject *) goPointObject sender: (id) sender;

@ end

@ interface FFCustomCellWithImage: UITableViewCell
@ property (nonatomic, weak) id <FFCustomCellWithImageDelegate> delegate;

当我去执行该方法时,应用程序崩溃,我不明白为什么。我做错了什么?

断点显示:EXC_BAD_ACCESS(code = 1,address = 0x50497265)

断点在此行停止:

-(void)cellaImmagine:(FFCustomCellWithImage *)cellaImmagine userPressedGoPointButtonAction:(UIButton *)goPointButton goPointObject:(PFObject *)goPointObject sender:(id)sender 

这是在具有Tableview的类中实现的方法:

FFTimeline.m:

#import "FFTimeline.h"
#import "FFCustomCellTimelineSocial.h"
#import "FFCustomCellWithImage.h"
#import "FFQueryCostanti.h"

@interface FFTimeline ()

@property (nonatomic, strong) PFObject *PostDetails;

@end



    -(void)cellaImmagine:(FFCustomCellWithImage *)cellaImmagine userPressedGoPointButtonAction:(UIButton *)goPointButton goPointObject:(PFObject *)goPointObject sender:(id)sender {

        self.PostDetails = [self.ArrayforPost objectAtIndex:[sender tag]];

        goPointObject = self.PostDetails;

        [cellaImmagine setGoPointButtonStatus:NO];

        BOOL GoPointAssigned = !goPointButton.selected;
        [cellaImmagine setGoPointStatus:GoPointAssigned];

        NSString *initialNumberButton = goPointButton.titleLabel.text;
        NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
        [formatter setLocale:[[NSLocale  alloc] initWithLocaleIdentifier:@"it_IT"]];
        NSNumber *numeroGoPointAssegnati = [formatter  numberFromString:goPointButton.titleLabel.text];

        if (GoPointAssigned) {
            numeroGoPointAssegnati = [NSNumber numberWithInt:[numeroGoPointAssegnati intValue] +1];
            [self SaveGoPointAssegnatiClass:sender];
        }

        else {
            if ([numeroGoPointAssegnati intValue] > 0) {
                numeroGoPointAssegnati = [NSNumber numberWithInt:[numeroGoPointAssegnati intValue] -1];
                [self DeleteGoPointToPostClass:sender];
            }
        }
        [goPointButton setTitle:[formatter stringFromNumber:numeroGoPointAssegnati] forState:UIControlStateNormal];


        if (GoPointAssigned) {
            [FFCustomCellWithImage assegnaGoPointPost:goPointObject block:^(BOOL succeeded, NSError *error) {
                FFCustomCellWithImage *actualHeaderView = (FFCustomCellWithImage *)[self tableView:self.FFTableView viewForHeaderInSection:goPointButton.tag];
                [actualHeaderView setGoPointButtonStatus:YES];
                [actualHeaderView setGoPointStatus:succeeded];

                if (!succeeded) {
                    [actualHeaderView.AddGoPoint setTitle:initialNumberButton forState:UIControlStateNormal];
                }
            }];

        } else {
            [FFCustomCellWithImage eliminaGoPointPost:goPointObject block:^(BOOL succeeded, NSError *error) {
                FFCustomCellWithImage *actualHeaderView = (FFCustomCellWithImage *)[self tableView:self.FFTableView  viewForHeaderInSection:goPointButton.tag];
                [actualHeaderView setGoPointButtonStatus:YES];
                [actualHeaderView setGoPointStatus:!succeeded];

                if (!succeeded) {
                    [actualHeaderView.AddGoPoint setTitle:initialNumberButton forState:UIControlStateNormal];
                }
            }];

        }

    }

0 个答案:

没有答案