This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section | |
{ | |
// The only header is in the first section | |
if (section != DeviceSettingsTableViewControllerSectionDeviceSettings) { | |
return [[UIView alloc] initWithFrame:CGRectZero]; | |
} | |
// If we've already created this headerView, return it, it should never change | |
if (self.headerView) { | |
return self.headerView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section | |
{ | |
// The only header is in the first section | |
if (section != DeviceSettingsTableViewControllerSectionDeviceSettings) { | |
return [[UIView alloc] initWithFrame:CGRectZero]; | |
} | |
// If we've already created this headerView, return it, it should never change | |
if (self.headerView) { | |
return self.headerView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section | |
{ | |
NSLog(@"section is %d", section); | |
if (section != DeviceSettingsTableViewControllerSectionDeviceSettings) { | |
return [[UIView alloc] initWithFrame:CGRectZero]; | |
} | |
if (self.headerView) { | |
return self.headerView; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When the connection state changes, update the label's color | |
RAC(headerView.batteryLabel, textColor) = [connectedStateSignal map:^id(id deviceConnectedState) { | |
return [deviceConnectedState integerValue] == MorseDeviceConnectedStateConnected ? [AVHexColor colorWithHex:0x666666] : [AVHexColor colorWithHex:0xF26322]; | |
}]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure that we can see all of our associated devices | |
NSSet * associatedDeviceIDs = [MorseUser currentUser].associatedDevices; | |
[associatedDeviceIDs map:^(NSString * input) | |
{ | |
return input.lowercaseString; | |
}]; | |
NSSet * nearbyDeviceIDs = [[tempNearby allKeys] asSet]; | |
if(![associatedDeviceIDs isSubsetOfSet:nearbyDeviceIDs]) | |
{ | |
for(NSString * deviceID in associatedDeviceIDs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ATAssociatedDevicesNotSeen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIView *wrapper = [UIView autoLayoutView]; | |
[wrapper constrainToWidth:300]; | |
self.textSubtextPairs = @[@{@"label": @"abcde", | |
@"detail": @"Bacon ipsum dolor sit amet sausage shank ball tip jowl shoulder spare ribs prosciutto leberkas sirloin pork cow bacon beef. Bacon drumstick tongue shank. Pancetta ribeye doner andouille tri-tip sirloin t-bone tenderloin sausage bacon. Ball tip salami pig frankfurter bacon meatloaf turkey ribeye boudin t-bone corned beef short ribs short loin tongue tenderloin. Meatball turducken swine kielbasa rump prosciutto doner, short ribs boudin shankle jowl shank pig short loin. Prosciutto drumstick pork belly shank meatball. Jowl frankfurter swine, spare ribs landjaeger strip steak flank t-bone ribeye ground round meatball kevin boudin leberkas.", | |
@"color" : [UIColor redColor]}, | |
@{@"label": @"cdef", | |
@"deta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
... | |
... | |
// When the gain changes | |
RACSignal *gainChangeSignal = [RACObserve(self, device.gain) deliverOn:[RACScheduler mainThreadScheduler]]; | |
// cell.auxiliaryLabel.text = @" "; | |
RAC(cell.auxiliaryLabel, text) = [gainChangeSignal map:^id(id value) { | |
// Get the gain lookup table | |
NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
DeviceSettingsHeaderView *headerView = [[DeviceSettingsHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, DEVICE_HEADER_HEIGHT)]; | |
[RACObserve(self, device) subscribeNext:^(MorseDevice *newDevice) { | |
// When the battery level changes, update the string | |
RACSignal *batteryChangeSignal = RACObserve(newDevice, batteryLevel); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DeviceSettingsHeaderView *headerView = [[DeviceSettingsHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, DEVICE_HEADER_HEIGHT)]; | |
+ | |
+ [RACObserve(self, device) subscribeNext:^(MorseDevice *newDevice) { | |
+ | |
+ // When the battery level changes, update the string | |
+ RACSignal *batteryChangeSignal = RACObserve(newDevice, batteryLevel); | |
+ RAC(headerView.batteryAndWifiLabel, text) = [[batteryChangeSignal deliverOn:[RACScheduler mainThreadScheduler]] map:^id(id value) { | |
+ | |
+ return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"battery is at", nil), newDevice.batteryLevelString]; | |
+ }]; |