Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*----- header snippet ------*/
- @property (strong, nonatomic) IBOutlet UIView *labels1;
- @property (strong, nonatomic) IBOutlet UIView *labels2;
- @property (strong, nonatomic) IBOutlet UIView *labels3;
- @property (strong, nonatomic) IBOutlet UIView *labels4;
- @property (strong, nonatomic) IBOutletCollection(UIView) NSArray *labelViews;
- /*----- end header -----*/
- UILabel *l1;
- UILabel *l2;
- //this code should be the same as the code thats uncommented below it but gets an unrecognised selector error
- /*for(UIView *view in self.labelViews){
- UILabel *l1 = (UILabel*)[view viewWithTag:1]; //this should be a label but seems to come out as a UIView
- UILabel *l2 = (UILabel*)[view viewWithTag:2];
- if([[Hex sharedHex] isPressureMode]){
- l1.text = [NSString stringWithFormat:@"%d", (int)[[Hex sharedHex] averageforChannel:view.tag]];
- }
- else {
- l1.text = [NSString stringWithFormat:@"%d", (int)([[[Hex sharedHex] atmosphericPressure] intValue] - [[Hex sharedHex] averageforChannel:view.tag])];
- }
- if(reference == view.tag)
- l2.text = @"Reference";
- else
- l2.text = [NSString stringWithFormat:@"Δ %d", ((int)[[Hex sharedHex] averageforChannel:view.tag] - (int)referenceAmount)];
- }*/
- //this below works fine
- switch (numberOfCylinders) {
- case 4:
- l1 = (UILabel*)[_labels4 viewWithTag:1];
- l2 = (UILabel*)[_labels4 viewWithTag:2];
- if([[Hex sharedHex] isPressureMode]){
- l1.text = [NSString stringWithFormat:@"%d", (int)[[Hex sharedHex] averageforChannel:3]];
- }
- else {
- l1.text = [NSString stringWithFormat:@"%d", (int)([[[Hex sharedHex] atmosphericPressure] intValue] - [[Hex sharedHex] averageforChannel:3])];
- }
- if(reference == 3)
- l2.text = @"Reference";
- else
- l2.text = [NSString stringWithFormat:@"\u0394 %d", ((int)[[Hex sharedHex] averageforChannel:3] - (int)referenceAmount)];
- case 3:
- l1 = (UILabel*)[_labels3 viewWithTag:1];
- l2 = (UILabel*)[_labels3 viewWithTag:2];
- if([[Hex sharedHex] isPressureMode]){
- l1.text = [NSString stringWithFormat:@"%d", (int)[[Hex sharedHex] averageforChannel:2]];
- }
- else {
- l1.text = [NSString stringWithFormat:@"%d", (int)([[[Hex sharedHex] atmosphericPressure] intValue] - [[Hex sharedHex] averageforChannel:2])];
- }
- if(reference == 2)
- l2.text = @"Reference";
- else
- l2.text = [NSString stringWithFormat:@"\u0394 %d", ((int)[[Hex sharedHex] averageforChannel:2] - (int)referenceAmount)];
- case 2:
- l1 = (UILabel*)[_labels2 viewWithTag:1];
- l2 = (UILabel*)[_labels2 viewWithTag:2];
- if([[Hex sharedHex] isPressureMode]){
- l1.text = [NSString stringWithFormat:@"%d", (int)[[Hex sharedHex] averageforChannel:1]];
- }
- else {
- l1.text = [NSString stringWithFormat:@"%d", (int)([[[Hex sharedHex] atmosphericPressure] intValue] - [[Hex sharedHex] averageforChannel:1])];
- }
- if(reference == 1)
- l2.text = @"Reference";
- else
- l2.text = [NSString stringWithFormat:@"\u0394 %d", ((int)[[Hex sharedHex] averageforChannel:1] - (int)referenceAmount)];
- case 1:
- l1 = (UILabel*)[_labels1 viewWithTag:1];
- l2 = (UILabel*)[_labels1 viewWithTag:2];
- if([[Hex sharedHex] isPressureMode]){
- l1.text = [NSString stringWithFormat:@"%d", (int)[[Hex sharedHex] averageforChannel:0]];
- }
- else {
- l1.text = [NSString stringWithFormat:@"%d", (int)([[[Hex sharedHex] atmosphericPressure] intValue] - [[Hex sharedHex] averageforChannel:0])];
- }
- if(reference == 0)
- l2.text = @"Reference";
- else
- l2.text = [NSString stringWithFormat:@"\u0394 %d", ((int)[[Hex sharedHex] averageforChannel:0] - (int)referenceAmount)];
- default:
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment