アプリを開発しています。そこにはスクロールビューがあります。そして、スクロールビューで2つのテーブルビューを取得しています。2番目のテーブルにセルを追加すると、キーボードが上になり、テーブルビューの最後のセルが表示されます。以下のコードを試しましたが、うまくいきません。誰でもこれを行う方法を知っていますか?. 私のアプリには、iTunes の「keep safe」アプリと同じ機能があります。
-(NSIndexPath *)lastIndexPath
{
NSInteger lastSectionIndex = MAX(0, [tvAlbumCell numberOfSections] - 1);
NSInteger lastRowIndex = MAX(0, [tvAlbumCell numberOfRowsInSection:lastSectionIndex] - 1);
return [NSIndexPath indexPathForRow:lastRowIndex inSection:lastSectionIndex];
}
-(void)goToBottom
{
NSIndexPath *lastIndexPath = [self lastIndexPath];
[tvAlbumCell scrollToRowAtIndexPath:lastIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}