VLCLocalNetworkListCell.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // VLCLocalNetworkListCell.m
  3. // VLC for iOS
  4. //
  5. // Created by Felix Paul Kühne on 10.08.13.
  6. // Copyright (c) 2013 VideoLAN. All rights reserved.
  7. //
  8. // Refer to the COPYING file of the official project for license.
  9. //
  10. #import "VLCLocalNetworkListCell.h"
  11. @implementation VLCLocalNetworkListCell
  12. + (VLCLocalNetworkListCell *)cellWithReuseIdentifier:(NSString *)ident
  13. {
  14. NSArray *nibContentArray = [[NSBundle mainBundle] loadNibNamed:@"VLCLocalNetworkListCell" owner:nil options:nil];
  15. NSAssert([nibContentArray count] == 1, @"meh");
  16. NSAssert([[nibContentArray lastObject] isKindOfClass:[VLCLocalNetworkListCell class]], @"meh meh");
  17. VLCLocalNetworkListCell *cell = (VLCLocalNetworkListCell *)[nibContentArray lastObject];
  18. return cell;
  19. }
  20. - (void)awakeFromNib
  21. {
  22. self.titleLabel.text = @"";
  23. self.subtitleLabel.text = @"";
  24. }
  25. - (void)setTitle:(NSString *)title
  26. {
  27. BOOL isDir = self.isDirectory;
  28. if (isDir)
  29. self.folderTitleLabel.text = title;
  30. else
  31. self.titleLabel.text = title;
  32. self.titleLabel.hidden = self.subtitleLabel.hidden = isDir;
  33. self.folderTitleLabel.hidden = !isDir;
  34. }
  35. - (void)setSubtitle:(NSString *)subtitle
  36. {
  37. self.subtitleLabel.text = subtitle;
  38. }
  39. + (CGFloat)heightOfCell
  40. {
  41. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
  42. return 80.;
  43. return 48.;
  44. }
  45. @end