【发布时间】:2011-03-01 14:22:52
【问题描述】:
-
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"bla %@", [节数]);
return [拥有数]; }
有谁知道如何实现一个简单的 NSLog,因为我遇到了一个错误。
【问题讨论】:
标签: objective-c iphone ipad
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"bla %@", [节数]);
return [拥有数]; }
有谁知道如何实现一个简单的 NSLog,因为我遇到了一个错误。
【问题讨论】:
标签: objective-c iphone ipad
section 的类型是 NSInteger。 NSInteger 类型声明的变量没有名称计数的函数。您可以使用以下代码打印部分值。
NSLog(@"bla %d",section)
【讨论】:
这是最常用的格式说明符:
您可以在此处查看其他格式说明符:
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
【讨论】:
NSLog(@"bla %d", section)
NSInteger 基本上只是一个 int(但具有稍微广为人知的特征)。
【讨论】: