在iPhone应用程序中.
我正在尝试获取indexPath.row值,以在以编程方式创建的tableview中选择的行为基础执行某些操作.
有人可以告诉我为什么indexPath.row值不正确.有点像21487 ...... 3?
NSUInteger nSections = [myTableView numberOfSections];
NSUInteger nRows = [myTableView numberOfRowsInSection:nSections];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow: nRows inSection:nSections];
NSLog(@"No of sections in my table view %d",nSections);
NSLog(@"No of rows in my table view %d",nRows);
NSLog(@"Value of selected indexPath Row %d", indexPath.row);
Run Code Online (Sandbox Code Playgroud)
谢谢,Aaryan
我只是使用for循环记录一个数字.
for (i=0; i<6; i++)
{
NSLog(@"%d",i);
}
Run Code Online (Sandbox Code Playgroud)
它在新行中打印数字,如:
1
2
3
4
5
Run Code Online (Sandbox Code Playgroud)
但我希望看到它像12345一样在一行上格式化.我怎么能这样做,任何想法?
谢谢Aaryan
iphone ×2