UITableViewの先頭行を設定するため次のようなコードを実装していた。
1 2 3 4 |
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [thumbneilView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO]; |
第4世代のiPodtouch(Ver.4.3.5)では問題なく動いていたけど(たまたまかも)
初代iPodtouch(Ver.3.1.3)では動かなかった。
SIGABRTが出ていたので何かとおもったら「NSRangeException」というようなエラーが出ていた。
次のようにデータを読み込んでおくと良いらしい。
1 2 3 4 5 6 |
//先頭位置を調整するまえに読み込んでおく [thumbneilView reloadData]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [thumbneilView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO]; |
コメントを残す