Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 将数据源添加到tableView而不使用Interbase并显示它_Iphone_Objective C_Uitableview - Fatal编程技术网

Iphone 将数据源添加到tableView而不使用Interbase并显示它

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

我有intreface:

@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];