这是我第一次在这里写,但我有一个无法处理的问题:(...
当我在另一个表中推送一个单元格后推送一个 UITableView 时,问题就出现了,如果我创建一个通用 UITableViewController 并推送它,它可以工作,但是如果我用所有必要的方法重新定义类就不起作用。
我之前在其他代码中实现过这个并且它可以工作,但是现在,在更新到 Xcode 4.5 后,它不起作用......
这是我要推送的视图的源代码:
@interface ECDetailSettingsTableView ()
@end
@implementation ECDetailSettingsTableView
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"ECDetailSettingsCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ECDetailSettingsCell"];
// Configure the cell...
return cell;
}
这是推送 tableview 的代码:
/********************* Pushing View *********************/
[tableView deselectRowAtIndexPath:indexPath animated: YES];
_themeTable = [self.storyboard instantiateViewControllerWithIdentifier:@"ECDetailSettingsViewController"];
[self.navigationController pushViewController:_themeTable animated:YES];
PD:谢谢大家,如果我犯了语法错误,对不起:)。