Iphone 将数据源添加到tableView而不使用Interbase并显示它
我有intreface:Iphone 将数据源添加到tableView而不使用Interbase并显示它,iphone,objective-c,uitableview,Iphone,Objective C,Uitableview,我有intreface: @interface Box : CDVPlugin <UITableViewDataSource, UITableViewDelegate, UISearchDisplayDelegate> 如何连接到数据源 我试着加上: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (NSInteg
@interface Box : CDVPlugin <UITableViewDataSource, UITableViewDelegate, UISearchDisplayDelegate>
如何连接到数据源
我试着加上:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
但它永远不会停在那里,桌子总是空的。
如何将其连接到数据(NSMutableArray)?您永远不会告诉表视图谁是数据源 您可以这样做:
UITableView *tView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 150, 150)];
tView.dataSource = self; // or something else
tView.delegate = self; // or something else
[[self.webView superview] addSubview:tView];
数据源用于创建单元格(cellForRowAtIndex:、numberOfRowsInSection:,等等)
委托用于操作,如(didselectRowatinedexPath:)我尝试了它,添加了:
tView.dataSource=self代码>但没有改变……它是否应该调用cellforrowatinexpath
?或者我应该转换到mapView.dataSource
数组吗?您需要一系列最小的数据源函数,它们是numberOfSectionsInTableView:、numberOfRowsInSection:、以及cellForRowAtIndexPath:您应该检查您是否真的告诉tableView它有单元格(也就是说,检查返回的节数是否大于0,以及给定节的行数是否大于0)它起作用了!!谢谢!!!那么tView.dataSource=self;说要使用在该接口中编写的tableView函数?
UITableView *tView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 150, 150)];
tView.dataSource = self; // or something else
tView.delegate = self; // or something else
[[self.webView superview] addSubview:tView];