Kaydet (Commit) f15a7ea1 authored tarafından siqi's avatar siqi

rebase

Change-Id: I7dcad32a9dff9d35e9641e80d9a8986a8b84889e
üst 7a0b6004
......@@ -356,6 +356,6 @@
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
<segue reference="YBj-zE-J7L"/>
<segue reference="geL-Q8-f61"/>
</inferredMetricsTieBreakers>
</document>
......@@ -16,6 +16,7 @@
@property (nonatomic, strong) CommunicationManager *comManager;
@property (nonatomic, weak) NSNotificationCenter* center;
@property (nonatomic, strong) id slideShowPreviewStartObserver;
@property (nonatomic, strong) NSIndexPath *lastSpinningCellIndex;
@end
......@@ -23,6 +24,7 @@
@synthesize center = _center;
@synthesize comManager = _comManager;
@synthesize lastSpinningCellIndex = _lastSpinningCellIndex;
@synthesize slideShowPreviewStartObserver = _slideShowPreviewStartObserver;
- (id)initWithStyle:(UITableViewStyle)style
......@@ -39,14 +41,23 @@
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.lastSpinningCellIndex = [[NSIndexPath alloc] init];
self.center = [NSNotificationCenter defaultCenter];
self.comManager = [CommunicationManager sharedComManager];
self.serverTable.dataSource = self;
self.serverTable.delegate = self;
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
self.slideShowPreviewStartObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_CONNECTED_SLIDESHOW_RUNNING
object:nil
queue:mainQueue
usingBlock:^(NSNotification *note) {
[self performSegueWithIdentifier:@"SlideShowPreview" sender:self ];
}];
}
-(void)viewWillAppear:(BOOL)animated
......@@ -63,8 +74,26 @@
#pragma mark - Table view delegate
- (void)disableSpinner
{
[self.tableView cellForRowAtIndexPath:self.lastSpinningCellIndex].accessoryView = nil;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if(self.comManager.state!=CONNECTING){
self.lastSpinningCellIndex = indexPath;
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[activityView startAnimating];
[cell setAccessoryView:activityView];
}
NSLog(@"Connecting to %@:%@", [[self.comManager.servers objectAtIndex:indexPath.row] serverName], [[self.comManager.servers objectAtIndex:indexPath.row] serverAddress]);
self.comManager.delegate = self;
[self.comManager connectToServer:[self.comManager.servers objectAtIndex:indexPath.row]];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)viewDidUnload {
......
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