浏览代码

VLCLocalNetworkListCell: add delegate protocol to trigger a download if the button is touched

Felix Paul Kühne 12 年之前
父节点
当前提交
ce90810053
共有 2 个文件被更改,包括 10 次插入1 次删除
  1. 8 0
      AspenProject/VLCLocalNetworkListCell.h
  2. 2 1
      AspenProject/VLCLocalNetworkListCell.m

+ 8 - 0
AspenProject/VLCLocalNetworkListCell.h

@@ -12,6 +12,8 @@
 
 @interface VLCLocalNetworkListCell : UITableViewCell
 
+@property (nonatomic, weak) id delegate;
+
 @property (nonatomic, strong) IBOutlet UILabel *titleLabel;
 @property (nonatomic, strong) IBOutlet UILabel *folderTitleLabel;
 @property (nonatomic, strong) IBOutlet UILabel *subtitleLabel;
@@ -31,3 +33,9 @@
 - (IBAction)triggerDownload:(id)sender;
 
 @end
+
+@protocol VLCLocalNetworkListCell <NSObject>
+
+- (void)triggerDownloadForCell:(VLCLocalNetworkListCell *)cell;
+
+@end

+ 2 - 1
AspenProject/VLCLocalNetworkListCell.m

@@ -66,7 +66,8 @@
 
 - (void)triggerDownload:(id)sender
 {
-    NSLog(@"Download requires adaptation of VLCHTTPDownloadViewController");
+    if ([self.delegate respondsToSelector:@selector(triggerDownloadForCell:)])
+        [self.delegate triggerDownloadForCell:self];
 }
 
 + (CGFloat)heightOfCell