我似乎无法找到我的错误,任何人都可以帮助我吗?当我尝试运行测试应用程序时它可以工作,但是当我点击Calendar segue时,它会显示一个空白的uitableview列表。我想让它向我展示文本中的“事件”
我的NSLOG关于阵列的详细信息:
2014-08-08 17:38:28.391 nths [2899:607]阵列内容:( “{\ n Date = \”9/14/14 \“; \ n信息= \”太太。福特的房间\“; \ n事件=会议; \ n}”, “{\ n Date = \”9/14/19 \“; \ n信息= \”ford room \“; \ n event = \”午餐在bravos \“; \ n}” )
以下是我认为会对此产生影响的所有代码。
CalendarViewController.h
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import "DataCellViewController.h"
@interface CalendarViewController : UIViewController <UITableViewDelegate> {
NSArray *eventArray;
}
@property (weak, nonatomic)IBOutlet UITableView *Datatable;
@end
CalendarViewController.m
#import "CalendarViewController.h"
@interface CalendarViewController ( )
@end
@implementation CalendarViewController
@synthesize Datatable;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self performSelector:@selector(retrieveFromParse)];
}
- (void) retrieveFromParse {
PFQuery *retrieveDate = [PFQuery queryWithClassName:@"Calendar"];
[retrieveDate findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
NSLog(@"%@",objects);
if (!error) {
eventArray = [[NSArray alloc] initWithArray:objects];
}
[Datatable reloadData];
}];
}
//Setup table of folder names
//get number of sections in tableview
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
//get number of rows by counting number of folders
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return eventArray.count;
}
//setup cells in tableView
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//setup cell
static NSString *CellIdentifier = @"CalenderCell";
DataCellViewController *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[DataCellViewController alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
NSDictionary *tempDict = [eventArray objectAtIndex:indexPath.row];
cell.eventTitle.text = [tempDict objectForKey:@"event"];
NSLog(@"array contents: %@", eventArray);
return cell;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
DataCellViewController.h
#import <UIKit/UIKit.h>
@interface DataCellViewController : UITableViewCell
@property (nonatomic, strong)IBOutlet UILabel *eventTitle;
@end
DataCellViewController.m
#import "DataCellViewController.h"
@interface DataCellViewController ( )
@end
@implementation DataCellViewController
@synthesize eventTitle;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end