Iphone UITableview重新加载问题iOS

Iphone UITableview重新加载问题iOS,iphone,xcode,uitableview,Iphone,Xcode,Uitableview,有时UITableView的reloadData方法不起作用,也就是说,当我像[tableView reloadData]那样编写时,它有时调用数据源方法,有时不调用 可能的问题是,有人能给我答案吗 这是我的密码: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations.

有时UITableView的reloadData方法不起作用,也就是说,当我像[tableView reloadData]那样编写时,它有时调用数据源方法,有时不调用

可能的问题是,有人能给我答案吗

这是我的密码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation  {
    // Return YES for supported orientations.   
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){      
    [self performSelector:@selector(changeSegmentControllerFrame) withObject:nil afterDelay:0.0001];        
    [m_kwikiTable reloadData];      
    return YES;     }   
    else        
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
}

尝试将断点放在

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
方法。。。因为如果它返回零,那么它就不会麻烦执行下一个方法,即

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

请添加您的代码。无论如何,请在代码中检查这些内容

如果cell==nil{},则应将cell.accessoryView设置为out 2.In-voidtableView:UITableView*tableView didSelectRowAtIndexPath:NSIndexPath*indexPath您可以使用tableView而不使用tableViewDistance可能是零? 3.在-voidviewDidLoad中,您应该首先调用[super viewDidLoad];然后进行定制。 通过此链接,这将帮助您调试:

将nslog放入委托中

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

在返回行计数以检查它是否正在重新调整0或任何其他值之前

发布代码将有助于理解您的问题和代码…请发布一些代码…这里我的问题是当我导航到一个视图并返回到第一个视图时,调用了我的tableview委托方法,但没有调用数据源方法。您在哪里除了shouldAutoRotateTointerFaceOrientation调用重载数据?在viewDidLoad或VIEWWILLEASE中?当我更改方向时,我的表格视图应重新加载,因此,我在shoudlAutoRotateToInterfaceOrientation方法中调用重载方法,该方法仅通过放置断点编号rowsInSection方法调用,但-UITableViewCell*tableView:UITableView*tableView cellForRowAtIndexPath:NSIndexPath*indexPath未调用,未了解问题所在。调用numberofrowsInSection时返回的行数是否大于0?这里的问题是,当我导航到一个视图并返回到第一个视图时,调用的tableview委托方法多于调用的tableview委托方法,但未调用Datasource方法-因此,在视图中将显示第一个视图的,设置tableview的委托和数据源,如果它有效,那么您将在某个地方取消数据源。