我在Xcode中得到相同的錯誤,並無法找出爲什麼(我的壞) 我試圖檢索已保存的數據,使用的uitexfield代碼低於 該部分是保存從視圖中檢索數據到故事板中的UITableViewCell
- (IBAction)saveCourseDetail:(id)sender
{
NSMutableDictionary *courseDictionary=[NSMutableDictionary new];
[courseDictionary setObject:courseName.text forKey:@"courseName"];
[courseDictionary setObject:courseDescription.text forKey:@"courseDescription"];
[courseDictionary setObject:classRoom.text forKey:@"classRoom"];
[courseDictionary setObject:teacherName.text forKey:@"teacherName"];
[courseDictionary setObject:buildingName.text forKey:@"buildingName"];
NSUserDefaults *savedData=[NSUserDefaults standardUserDefaults];
[savedData setObject:courseDictionary forKey:@"courseDictionary"];
[savedData synchronize];
// [self.delegate reloadTableData];
[[NSNotificationCenter defaultCenter] postNotificationName:@"CourseAddedNotification" object:nil];
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark Course Tableview
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *string = [_dataArray objectAtIndex:indexPath.row];
NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text=string;
return cell;
}
and the tableview that i'm trying to get the saved course details
#pragma mark - Table View Delegate -
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CourseCell *cell=[tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
if (!cell) {
cell = [[CourseCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
return cell;
}
,但我不斷收到同樣的錯誤,而─ 2013年11月26日14:43:19.496 SidebarDemo [1170:70B] *在斷言失敗 - [UITableView的dequeueReusableCellWithIdentifier:forIndexPath:]/SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:5261 2013-11-26 14:43:19.500 SidebarDemo [1170:70b] *終止應用程序,由於未捕獲的異常'NSInternalInconsistencyException',原因:'無法使用標識符單元出列單元格 - 必須爲標識符註冊一個筆尖或類或連接故事板中的原型單元格'
任何人都可以幫助我?
你有帶小區的IDENTIFER在你的故事板的原型細胞? – bobnoble