Ios 点击按钮时UITableView重新加载数据不工作

Ios 点击按钮时UITableView重新加载数据不工作,ios,objective-c,uitableview,Ios,Objective C,Uitableview,当运行calendarDidDateSelected时,我希望self.agendable运行reloadData,但这似乎没有发生。据我所知,该表设置正确,我已将其设置为在重新加载时更新cellf.agendablearray中cellforrowatinexpath的内容。我做错了什么 我这样摆好桌子: - (void)viewDidLoad { [super viewDidLoad]; // Set up Day Agenda table CGRect frame

当运行
calendarDidDateSelected
时,我希望
self.agendable
运行
reloadData
,但这似乎没有发生。据我所知,该表设置正确,我已将其设置为在重新加载时更新
cellf.agendablearray
cellforrowatinexpath
的内容。我做错了什么

我这样摆好桌子:

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Set up Day Agenda table
    CGRect frame = CGRectMake(0,380,self.view.frame.size.width,self.view.frame.size.height);

    UITableView *agendaTable = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];
    agendaTable.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

    agendaTable.delegate = self;
    agendaTable.dataSource = self;
    [agendaTable reloadData];

    [self.view addSubview:agendaTable];
    /////

     self.agendaTableArray = [[NSArray alloc] init];
     self.agendaTableArray = @[@"No events today!"];

    [self.calendar setMenuMonthsView:self.calendarMenuView];
    [self.calendar setContentView:self.calendarContentView];
    [self.calendar setDataSource:self];
}
相关
cellforrowatinexpath
code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ///...earlier code snipped for brevity

    // title of the item
    if (self.datePicked == [NSNumber numberWithInt:16]) {
        NSLog(@"cellForRowAtIndexPath says self.datePicked is 16");
        self.agendaTableArray = @[@"Dinner with Rebekah", @"Meeting with John"];
    }

    else {
        self.agendaTableArray = @[@"No events today!"];
    }

    cell.textLabel.text = self.agendaTableArray[indexPath.row];
    cell.textLabel.font = [UIFont systemFontOfSize:14];
    return cell;
}
调用calendarDidDateSelected如下所示:

- (void)calendarDidDateSelected:(JTCalendar *)calendar date:(NSDate *)date
{
    NSLog(@"Date: %@", date);

    // NSDateFormatter is used to create a date from a string
    // static keyword is used to avoid create a new instance each time calendarDidDateSelected is called
    static NSDateFormatter *dateFormatter = nil;
    if(!dateFormatter){
        dateFormatter = [NSDateFormatter new];
        dateFormatter.dateFormat = @"yyyy-MM-dd"; // Read the documentation for dateFormat
    }

    // If date picked is June 16th
    NSDate *juneSixteenth = [dateFormatter dateFromString:@"2015-06-16"];
    if([juneSixteenth compare:date] == NSOrderedSame){

        self.datePicked = [NSNumber numberWithInt:16];
        NSLog(@"self.datePicked: %@", self.datePicked);

    }
    [self.agendaTable reloadData];
}

您是否正确地将您创建的agendable分配给viewDidLoad中的“agendable”属性

self.agendaTable = agendaTable;

表是否首次加载数据?您是否尝试调试应用程序并检查它是否到达行
self.agendablearray=@[@“与丽贝卡共进晚餐”,“与约翰会面”]点击??