我有一個屬性,特別是在UITableViewCell
(可重用)的子類UIActivityIndicatorView
。當選中一個單元格時,將從URL中獲取AVAsset
,但我希望UIActivityIndicatorView
在從URL中獲取足夠的數據並且準備好使用AVAsset
時隱藏。但我不知道如何訪問被選中的單元格。我想最好的辦法是設置一個指向屬性中最後一個選定單元格的指針,然後像這樣訪問它。訪問屬性的自定義UITableView單元格
@interface
@property (nonatomic, retain) customTableViewCustomCell *activeCell;
@end
@implementation
@synthesize activeCell;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// remember pointer to active cell for later
activeCell = [tableView cellForRowAtIndexPath:indexPath];
}
- (void) updateInterface
{
[activeCell.activityIndicator stopAnimating];
}
但我得到一個編譯錯誤約不兼容的指針類型,因爲cellForRowAtIndexPath:indexPath
返回一個UITableViewCell
,而不是一個customUITableViewCell
。我需要一個指向customUITableViewCell
的指針,所以我有權訪問activtyIndicator
IBOutlet
屬性。
您可以嘗試使用NSNotification中心,而直到足夠的數據被下載和使用委託方法,你可以刷新你的表。 – 2012-03-10 12:19:02