Objective c pushViewController之后的自更改值

Objective c pushViewController之后的自更改值,objective-c,uiviewcontroller,uinavigationcontroller,self,Objective C,Uiviewcontroller,Uinavigationcontroller,Self,我正在使用UINavigationController,我想重用UITableView。为此,我为表属性创建了数据源。以下是视图的文件 单词表.h: @interface WordList : UIViewController <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>{ } @property (nonatomic, retain) IBOutlet UIViewController *s

我正在使用UINavigationController,我想重用UITableView。为此,我为表属性创建了数据源。以下是视图的文件

单词表.h:

@interface WordList : UIViewController <UITableViewDelegate, UITableViewDataSource,   UISearchBarDelegate>{
}

@property (nonatomic, retain) IBOutlet UIViewController *selfRef;
@property (assign) NSDictionary *wordList;
@property (assign) NSArray *indexList;
@property (assign) UINavigationController *useNC;


- (void)setNavigationController:(UINavigationController *)nc;
- (void)setSource:(NSString *)source;
- (void)dealloc;

@end
我仍然在寻找关于Objective-C属性的方法,所以我可能误用了它们。问题是,即使setSource:work中的赋值是空的,表中也没有显示任何数据。请参阅下面的NSLog输出

2011-10-17 10:58:22.387 ASL Dictionary[381:207] <WordList: 0x614f0b0> - WorldList:setSource
2011-10-17 10:58:22.394 ASL Dictionary[381:207] Word list: {
    H =     (
        "HOME (noun)"
    );
}
2011-10-17 10:58:22.395 ASL Dictionary[381:207] Index list: (
    H
)
2011-10-17 10:58:22.396 ASL Dictionary[381:207] <WordList: 0x614f0b0> - WorldList:setNavigationController(<UINavigationController: 0x573e780>)
2011-10-17 10:58:22.402 ASL Dictionary[381:207] <WordList: 0x57806f0> - numberOfSectionInTableView(0): (null)
很明显,为什么该表不显示数据,对NumberOfSectionsTable:的调用返回0。我想知道的是为什么。我很确定,正如你从日志中看到的,这是因为self的值与前两个调用不同。为什么会这样?第三个调用发生在对pushViewController的调用之后:。这就是原因吗?我是做错了还是错过了一些简单的事情


谢谢您的时间。

您的节数返回nul,这可能是问题所在

努力将其编码为1返回1;还需要记录CellIdentifier的值,因为您可能不返回任何内容


HTH

对不起,我已经知道它返回零,我在问题中提到了这一点。我知道它为什么返回nil,因为WordList的实例上没有设置任何内容。您可以从控制台输出中看到为什么被调用的实例从0x614f0b0更改为0x57806f0。我在问为什么正在使用的实例在调用之间发生变化。
2011-10-17 10:58:22.387 ASL Dictionary[381:207] <WordList: 0x614f0b0> - WorldList:setSource
2011-10-17 10:58:22.394 ASL Dictionary[381:207] Word list: {
    H =     (
        "HOME (noun)"
    );
}
2011-10-17 10:58:22.395 ASL Dictionary[381:207] Index list: (
    H
)
2011-10-17 10:58:22.396 ASL Dictionary[381:207] <WordList: 0x614f0b0> - WorldList:setNavigationController(<UINavigationController: 0x573e780>)
2011-10-17 10:58:22.402 ASL Dictionary[381:207] <WordList: 0x57806f0> - numberOfSectionInTableView(0): (null)