ios – UITableView&Controller为我提供了空表视图

ios – UITableView&Controller为我提供了空表视图,第1张

概述我有一个应用程序(导航控制器),其中第二个控制器是一个表视图控制器.我能够通过segue发送我所需的数据,但无法以编程方式更新tableview中的条目. 我是IOS的新手. 这是我的头文件 #import <UIKit/UIKit.h>@interface HCIResultListViewController : UITableViewController@property (stron 我有一个应用程序(导航控制器),其中第二个控制器是一个表视图控制器.我能够通过segue发送我所需的数据,但无法以编程方式更新tablevIEw中的条目.

我是IOS的新手.

这是我的头文件

#import <UIKit/UIKit.h>@interface HCIResultListVIEwController : UItableVIEwController@property (strong,nonatomic) NSMutableDictionary *resultList;@property (strong,nonatomic) IBOutlet UItableVIEw *tableListVIEw;@end

这是我的实现文件.

- (NSInteger)numberOfSectionsIntableVIEw:(UItableVIEw *)tableVIEw{    #warning Potentially incomplete method implementation.    // Return the number of sections.    return 0;}- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section{#warning Incomplete method implementation.// Return the number of rows in the section.return 0;}- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{static Nsstring *CellIDentifIEr = @"HelloCell";UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr];if (cell == nil){    cell = [[UItableVIEwCell alloc] initWithStyle:UItableVIEwCellStyleSubTitle reuseIDentifIEr:CellIDentifIEr];}cell.textLabel.text = @"Hello";// Configure the cell...return cell;}

谁能告诉我如何使用tablevIEw&控制器?

我确实经历了几个文档和示例,但实际上无法理解

解决方法 您需要指定表视图的行和节数.像这样.

- (NSInteger)numberOfSectionsIntableVIEw:(UItableVIEw *)tableVIEw    {        #warning Potentially incomplete method implementation.        // Return the number of sections.        return 1;    }    - (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section    {    #warning Incomplete method implementation.    // Return the number of rows in the section.    return [sourceData Count]//i.e.,10;    }    - (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath    {    static Nsstring *CellIDentifIEr = @"HelloCell";    UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr];    if (cell == nil){        cell = [[UItableVIEwCell alloc] initWithStyle:UItableVIEwCellStyleSubTitle reuseIDentifIEr:CellIDentifIEr];    }    cell.textLabel.text = @"Hello";    // Configure the cell...    return cell;    }
总结

以上是内存溢出为你收集整理的ios – UITableView&Controller为我提供了空表视图全部内容,希望文章能够帮你解决ios – UITableView&Controller为我提供了空表视图所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1000201.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-21
下一篇2022-05-21

发表评论

登录后才能评论

评论列表(0条)

    保存