我有tabbarcontroller應用程序。在第一個標籤本身,我有桌面視圖。我沒有添加任何內容到NIB文件。我剛剛創建了UITableViewController
的子類。我的細胞是自定義的。它確實顯示了具有適當值的表格。使用pushviewcontroller後,TableView不滾動
但是在didSelectRow:
方法中,我叫pushViewController
。一旦我從pushViewController
中按下回到原始屏幕並開始滾動,我的應用程序就會終止。
任何人都可以幫我解決這個問題嗎?
//代碼
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
NSString *TitleValue = [listOfTitles objectAtIndex:indexPath.row];
cell.primaryLabel.text = TitleValue;
NSString *DateValue = [listOfDates objectAtIndex:indexPath.row];
cell.secondaryLabel.text = DateValue;
NSString *descValue=[listOfDesc objectAtIndex:indexPath.row];
cell.thirdlabel.text = descValue;
if([unreadFlag objectAtIndex:indexPath.row] == @"0")
{
cell.primaryLabel.font = [UIFont boldSystemFontOfSize:15.0];
}
else {
cell.primaryLabel.font = [UIFont systemFontOfSize:15.0];
}
return cell;
//[CustomCell release];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 105;
}
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CustomCell *testcell = [tableView cellForRowAtIndexPath:indexPath];
testcell.primaryLabel.font = [UIFont systemFontOfSize:15.0];
[unreadFlag replaceObjectAtIndex:indexPath.row withObject:@"1"];
selectedNS = [listOfIds objectAtIndex:indexPath.row];
//Initialize the detail view controller and display it.
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
dvController.selectedNS=selectedNS;
[self.navigationController pushViewController:dvController animated:NO];
[dvController release];
dvController = nil;
testcell.primaryLabel.font = [UIFont systemFontOfSize:15.0];
[testcell release];
}
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
//return UITableViewCellAccessoryDetailDisclosureButton;
return UITableViewCellAccessoryDisclosureIndicator;
}
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
[self tableView:tableView didSelectRowAtIndexPath:indexPath];
}
謝謝
安基塔
一些代碼真的會有所幫助。如果你不介意。 – visakh7 2011-03-16 07:05:13
你可以請張貼堆棧跟蹤? – hennes 2011-03-16 07:12:41
你們有誰能解決這個問題? – Anks 2011-03-16 08:36:40