无法为UITableView实现数据源方法

时间:2016-06-01 00:58:23

标签: ios objective-c uitableview unrecognized-selector

我想加载plist文件并使用plist的数据来初始化TableView。

当我使用时:

foreach($reviews as $key => $r) {
   $date = explode(" ", $r['created_at']);
   $date = $date[0];
   $time = date_format(date_create($date), "D F d, Y");
   $reviews[$key]['created_at'] = $time;
}

Sub tester() Dim rng As Range Set rng = ActiveSheet.Range("A2") LinkToFile "C:\_Stuff\test", "temp report.xlsx", "Sheet1", "A1:D20", rng Set rng = ActiveSheet.Range("F2") LinkToFile "C:\_Stuff\test", "temp report.xlsx", "Sheet1", "A1", rng End Sub Sub LinkToFile(fPath As String, fName As String, shtName As String, _ addr As String, rngInsert As Range) Dim rngTmp As Range, f As String If Right(fPath, 1) <> "\" Then fPath = fPath & "\" 'win only! f = "='" & fPath & "[" & fName & "]" & shtName & "'!" & addr 'linking to a range, or a single cell ? If InStr(addr, ":") > 0 Then Set rngTmp = rngInsert.Parent.Range(addr) 'to get num rows/cols rngInsert.Resize(rngTmp.Rows.Count, rngTmp.Columns.Count).FormulaArray = f Else rngInsert.Formula = f End If End Sub 总是0.NSLog可以输出正确的数据。

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [self.data count];
}

和plist源代码

[self.data count]

如何解决?

2 个答案:

答案 0 :(得分:1)

请使用UITableView类的数据源方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.data count];
}

不要忘记设置tableview的数据源。

chosentableView.datasource = self;

答案 1 :(得分:0)

您只需使用默认方法.top-bar-dark { background-color: #a92419; } .top-bar-light { background-color: #f3f3f3; } .top-bar-light .top-dark-right li { border-color: #ddd; } .top-bar-light .top-dark-right li a:hover { color: #32c5d2; } .top-bar-socials { line-height: 30px; padding-top: 5px; } .top-bar-socials:after { display: table; clear: both; content: ""; } .top-bar-socials a { margin: 0px 8px; text-decoration: none; font-size:18px; color: #fff; } .top-dark-right { margin: 0px; padding: 0px; } .top-dark-right li { line-height: 40px; border-left: 1px solid #932015; padding: 0px 10px; } .top-dark-right li, .top-dark-right li a { color: #d7d7d7; font-size: 12px; } .top-dark-right li i { margin-right: 5px; } .top-dark-right li a:hover { color: #fff; } a.login{ text-decoration: none; } .fa-facebook:hover{ color:#3b5998; } .fa-twitter:hover{ color:#1dcaff; } .fa-linkedin:hover{ color:#007bb5; } 类, 并通过uitableview连接tableview的dataSource。 改变你的代码。

code/xib/storyboard