2013-05-29 5 views
5

ImはこのようのUITableViewは

`

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate: (BOOL)decelerate{ 
isDragging_msg = FALSE; 
[tblSongs reloadData]; 

}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ 
isDecliring_msg = FALSE; 
[tblSongs reloadData]; } 


- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{ 
isDragging_msg = TRUE; 

}

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{ 
isDecliring_msg = TRUE; } 

`

01のスクロール UITableViewを検出するスクロールしているかを検出する方法

しかし、私はsevaralをロードする必要がありますUITableViewsこの検出の下で私は別々に各テーブルを再読み込みする必要があります。だから、どのテーブルが現在スクロールしているかを検出することができます。

おかげ

答えて

8
ここに述べたように

表ビューがスクロールビューです:Is it possible to access a UITableView's ScrollView In Code From A Nib?

だから、あなただけのスクロールビューには、例えば、あなたがしたいテーブルビューであるかどうかを各デリゲートメソッドに渡されたスクロールビューを確認することができます。

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ 
    if (scrollView == tblSongs) { 
     isDragging_msg = FALSE; 
     [tblSongs reloadData]; 
    } 
} 
0

あなたはすべてのこれらの方法におけるscrollViewパラメータがためには何だと思いますか?

+0

テーブルのスクロールビューにのみいくつかのタグを追加できますか? – iDia

+0

またはスクロールビューは、UITableViewと同じタグ番号を取得します。 – iDia

0

各テーブルでイベントを検出できます。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    //<your stuff> 

    [super touchesBegan:touches withEvent:event]; 
} 

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    //<your stuff> 

    [super touchesMoved:touches withEvent:event]; 
} 

- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event 
{ 
    //<your stuff> 

    [super touchesEnded:touches withEvent:event]; 
} 

- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event 
{ 
    //<your stuff> 
    [super touchesCancelled:touches withEvent:event]; 
} 

と、特定のテーブルビューをリロードすることができますのUITableViewの使用上のタッチイベントを受信するUITableView event

。ありがとう