Commit b2c2ae89 authored by Tobias's avatar Tobias

add reload button

fix multiple overlaying cells bug
use custom cell subclass
parent 865bba9a
/*****************************************************************************
* VLC for iOS
*****************************************************************************
* Copyright (c) 2015 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Tobias Conradi <videolan # tobias-conradi.de>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import <UIKit/UIKit.h>
extern NSString *const VLCServerBrowsingTVCellIdentifier;
@interface VLCServerBrowsingTVCell : UITableViewCell
@end
/*****************************************************************************
* VLC for iOS
*****************************************************************************
* Copyright (c) 2015 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Tobias Conradi <videolan # tobias-conradi.de>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "VLCServerBrowsingTVCell.h"
NSString *const VLCServerBrowsingTVCellIdentifier = @"VLCServerBrowsingTVCell";
@implementation VLCServerBrowsingTVCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
return [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
}
@end
......@@ -10,13 +10,13 @@
*****************************************************************************/
#import "VLCServerBrowsingTVTableViewController.h"
#import "VLCServerBrowsingTVCell.h"
@interface VLCServerBrowsingTVTableViewController ()
@property (nonatomic, readonly) id<VLCNetworkServerBrowser>serverBrowser;
@property (nonatomic) NSByteCountFormatter *byteCounterFormatter;
@end
static NSString *const cellIdentifier = @"cell";
@implementation VLCServerBrowsingTVTableViewController
......@@ -33,7 +33,9 @@ static NSString *const cellIdentifier = @"cell";
- (void)viewDidLoad {
[super viewDidLoad];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellIdentifier];
[self.tableView registerClass:[VLCServerBrowsingTVCell class] forCellReuseIdentifier:VLCServerBrowsingTVCellIdentifier];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reloadData)];
}
- (void)viewDidAppear:(BOOL)animated {
......@@ -43,6 +45,12 @@ static NSString *const cellIdentifier = @"cell";
#pragma mark -
- (void)reloadData {
[self.serverBrowser update];
}
#pragma mark -
- (void)networkServerBrowserDidUpdate:(id<VLCNetworkServerBrowser>)networkBrowser {
self.title = networkBrowser.title;
[self.tableView reloadData];
......@@ -78,10 +86,10 @@ static NSString *const cellIdentifier = @"cell";
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
VLCServerBrowsingTVCell *cell = [tableView dequeueReusableCellWithIdentifier:VLCServerBrowsingTVCellIdentifier forIndexPath:indexPath];
if (cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
if (!cell) {
cell = [[VLCServerBrowsingTVCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:VLCServerBrowsingTVCellIdentifier];
}
id<VLCNetworkServerBrowserItem> item = self.serverBrowser.items[indexPath.row];
......
......@@ -274,6 +274,7 @@
DD3567F81B6768FC00338947 /* VLCWatchTableController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567EC1B6768FC00338947 /* VLCWatchTableController.m */; };
DD3567F91B6768FC00338947 /* WKInterfaceObject+VLCProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567EE1B6768FC00338947 /* WKInterfaceObject+VLCProgress.m */; };
DD3EA6311AF50CFE007FF096 /* VLCWatchMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EA6301AF50CFE007FF096 /* VLCWatchMessage.m */; };
DD3EABE91BE13D5B003668DA /* VLCServerBrowsingTVCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EABE81BE13D5B003668DA /* VLCServerBrowsingTVCell.m */; };
DD3EFEED1BDEBA3800B68579 /* VLCNetworkServerBrowserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EFEEA1BDEBA3800B68579 /* VLCNetworkServerBrowserViewController.m */; };
DD3EFEEE1BDEBA3800B68579 /* VLCServerListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EFEEC1BDEBA3800B68579 /* VLCServerListViewController.m */; };
DD3EFF2D1BDEBCE500B68579 /* VLCLocalNetworkServiceBrowserFTP.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EFEF21BDEBCE500B68579 /* VLCLocalNetworkServiceBrowserFTP.m */; };
......@@ -909,6 +910,8 @@
DD3567EE1B6768FC00338947 /* WKInterfaceObject+VLCProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WKInterfaceObject+VLCProgress.m"; sourceTree = "<group>"; };
DD3EA62F1AF50CFE007FF096 /* VLCWatchMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCWatchMessage.h; sourceTree = "<group>"; };
DD3EA6301AF50CFE007FF096 /* VLCWatchMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCWatchMessage.m; sourceTree = "<group>"; };
DD3EABE71BE13D5B003668DA /* VLCServerBrowsingTVCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCServerBrowsingTVCell.h; sourceTree = "<group>"; };
DD3EABE81BE13D5B003668DA /* VLCServerBrowsingTVCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCServerBrowsingTVCell.m; sourceTree = "<group>"; };
DD3EFEE91BDEBA3800B68579 /* VLCNetworkServerBrowserViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCNetworkServerBrowserViewController.h; path = Sources/LocalNetworkConnectivity/VLCNetworkServerBrowserViewController.h; sourceTree = SOURCE_ROOT; };
DD3EFEEA1BDEBA3800B68579 /* VLCNetworkServerBrowserViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCNetworkServerBrowserViewController.m; path = Sources/LocalNetworkConnectivity/VLCNetworkServerBrowserViewController.m; sourceTree = SOURCE_ROOT; };
DD3EFEEB1BDEBA3800B68579 /* VLCServerListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCServerListViewController.h; path = Sources/LocalNetworkConnectivity/VLCServerListViewController.h; sourceTree = SOURCE_ROOT; };
......@@ -1826,6 +1829,8 @@
7D7EF3D81BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.m */,
DDEAECF21BDFEAE300756C83 /* VLCLocalNetworkServerTVCell.h */,
DDEAECF31BDFEAE300756C83 /* VLCLocalNetworkServerTVCell.m */,
DD3EABE71BE13D5B003668DA /* VLCServerBrowsingTVCell.h */,
DD3EABE81BE13D5B003668DA /* VLCServerBrowsingTVCell.m */,
);
name = "Network UI";
sourceTree = "<group>";
......@@ -2647,6 +2652,7 @@
7D7EF3DA1BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.m in Sources */,
DD3EFF521BDEBCE500B68579 /* VLCPlexWebAPI.m in Sources */,
7D60696C1BD93BE200AB765C /* VLCCloudStorageTableViewCell.m in Sources */,
DD3EABE91BE13D5B003668DA /* VLCServerBrowsingTVCell.m in Sources */,
7D7EF3DD1BD5779F00CD4CEE /* VLCPlaybackController.m in Sources */,
DD3EFF361BDEBCE500B68579 /* VLCLocalNetworkServiceBrowserNetService.m in Sources */,
7D1334831BE135700012E919 /* VLCCloudStorageTVTableViewController.m in Sources */,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment