我想A视图控制器切换另一个B视图控制器,第一次,我推(按下GuestBook按钮)和TableView获取信息ok,然后按下返回按钮ok,再次推(按下GuestBook按钮),JSON数据NSLog
有消息,但tableview数据没有出现!发生了什么?
PS:我使用故事板!有一个自定义单元格xib!
是
- (IBAction)toHostGuestBook:(id)sender {
hgbvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ToHostGuestBookSegue"];
hgbvc.eventidStr = eventidStr;
NSLog(@"hgbvc.eventidStr:%@",hgbvc.eventidStr);
[self.navigationController pushViewController:hgbvc animated:YES];
}
BM
- (IBAction)backToHostMainEventDetail:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
BM
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *GuestBookCellIdentifier = @"GuestBookCellIdentifier";
static BOOL nibsRegistered = NO;
if (!nibsRegistered) {
UINib *nib = [UINib nibWithNibName:@"GuestBookCell" bundle:nil];
[tableView registerNib:nib forCellReuseIdentifier:GuestBookCellIdentifier];
nibsRegistered = YES;
}
gbcell = [tableView dequeueReusableCellWithIdentifier:GuestBookCellIdentifier];
if (gbcell == nil) {
gbcell = [[GuestBookCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:GuestBookCellIdentifier];
}
NSDictionary *dict = [messageRows objectAtIndex: indexPath.row];
gbcell.nicknameStr = [dict objectForKey:@"vusr"];
gbcell.dateStr = [dict objectForKey:@"date"];
gbcell.messageStr = [dict objectForKey:@"message"];
return gbcell;
}