// // Cell_Reti_sismicheTableViewCell.m // Earthquake Network // // Created by Luca Beretta on 01/11/18. // Copyright © 2018 Luca Beretta. All rights reserved. // #import "Cell_Reti_sismicheTableViewCell.h" @implementation Cell_Reti_sismicheTableViewCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } -(void)setupView{ UILabel *place = (UILabel *)[self viewWithTag:1]; place.text = self.sisma.place; UILabel *provider = (UILabel *)[self viewWithTag:2]; provider.text = self.sisma.provider; UILabel *magnitudo = (UILabel *)[self viewWithTag:3]; magnitudo.text = NSLocalizedString(@"Magnitudo", @""); UILabel *magnitudoValore = (UILabel *)[self viewWithTag:4]; magnitudoValore.text = [NSString stringWithFormat:@"%@ mb", self.sisma.magnitude]; UILabel *profondita = (UILabel *)[self viewWithTag:5]; profondita.text = [NSString stringWithFormat:@"%@: %.2f Km", NSLocalizedString(@"Profondità", @""), [self.sisma.depth floatValue]]; UILabel *data = (UILabel *)[self viewWithTag:6]; int tempo = 0; if ([self.sisma.difference intValue] > 60) { tempo = [self.sisma.difference intValue]/60; data.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Data(Ora tua):", @"") , [NSString stringWithFormat:@"%@ - %d %@", self.sisma.date, tempo, NSLocalizedString(@"ore fa", @"")]]; }else{ data.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Data(Ora tua):", @"") , [NSString stringWithFormat:@"%@ - %@ %@", self.sisma.date, self.sisma.difference, NSLocalizedString(@"minuti fa", @"")]]; } // UILabel *dataValue = (UILabel *)[self viewWithTag:8]; // dataValue.text = ; UILabel *distanza = (UILabel *)[self viewWithTag:9]; distanza.text = [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Distanza", @""), [NSString stringWithFormat:@"%i km %@", [self.sisma.distanzaKM intValue], NSLocalizedString(@"dalla tua posizione", @"")]]; // UILabel *distanzaValue = (UILabel *)[self viewWithTag:11]; // distanzaValue.text = ; self.mappaButton = (UIButton *)[self viewWithTag:12]; [self.mappaButton setTitle:NSLocalizedString(@"MAPPA", @"") forState:UIControlStateNormal]; self.mappaButton.layer.borderWidth = 1; self.mappaButton.layer.borderColor = [UIColor blackColor].CGColor; self.mappaButton.layer.cornerRadius = 5; // [mappa addTarget:self action:@selector(apriMappa:) forControlEvents:UIControlEventTouchDown]; UIButton *trend = (UIButton *)[self viewWithTag:13]; [trend setTitle:NSLocalizedString(@"TRENS", @"") forState:UIControlStateNormal]; trend.layer.borderWidth = 1; trend.layer.borderColor = [UIColor blackColor].CGColor; trend.layer.cornerRadius = 5; self.meteoButton = (UIButton *)[self viewWithTag:14]; [self.meteoButton setTitle:NSLocalizedString(@"METEO", @"") forState:UIControlStateNormal]; self.meteoButton.layer.borderWidth = 1; self.meteoButton.layer.borderColor = [UIColor blackColor].CGColor; self.meteoButton.layer.cornerRadius = 5; UIButton *config = (UIButton *)[self viewWithTag:15]; [config setTitle:NSLocalizedString(@"CONFIG", @"") forState:UIControlStateNormal]; config.layer.borderWidth = 1; config.layer.borderColor = [UIColor blackColor].CGColor; config.layer.cornerRadius = 5; self.dettagliMappa = (UIButton *)[self viewWithTag:300]; self.clickMappa = (UIButton *)[self viewWithTag:112]; UIView *containerView = (UIView *)[self viewWithTag:100]; if([self.sisma.magnitude doubleValue] > 4.0){ containerView.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE; provider.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI; self.mappaButton.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI; trend.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI; self.meteoButton.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI; config.backgroundColor = COLORE_CELLA_MAGNITUTE_FORTE_ETI; magnitudoValore.textColor = COLORE_CELLA_MAGNITUTE_FORTE_TESTO; }else if ([self.sisma.magnitude doubleValue] < 3.0){ containerView.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA; provider.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI; self.mappaButton.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI; trend.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI; self.meteoButton.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI; config.backgroundColor = COLORE_CELLA_MAGNITUTE_LEGGERA_ETI; magnitudoValore.textColor = COLORE_CELLA_MAGNITUTE_LEGGERA_TESTO; }else{ containerView.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA; provider.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI; self.mappaButton.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI; trend.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI; self.meteoButton.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI; config.backgroundColor = COLORE_CELLA_MAGNITUTE_MEDIA_ETI; magnitudoValore.textColor = COLORE_CELLA_MAGNITUTE_MEDIA_TESTO; } containerView.layer.cornerRadius = 2; containerView.layer.masksToBounds = NO; containerView.layer.shadowOffset = CGSizeMake(0.0, 2); containerView.layer.shadowRadius = 5; containerView.layer.shadowOpacity = 0.5; } -(void)createOtherButton{ self.condividi = (UIButton *)[self viewWithTag:17]; [self.condividi setTitle:NSLocalizedString(@"CONDIVIDI", @"") forState:UIControlStateNormal]; self.condividi.layer.borderWidth = 1; self.condividi.layer.borderColor = [UIColor blackColor].CGColor; self.condividi.layer.cornerRadius = 5; // [self.condividi addTarget:self action:@selector(condividiView) forControlEvents:UIControlEventTouchUpInside]; self.chiudi = (UIButton *)[self viewWithTag:18]; [self.chiudi setTitle:NSLocalizedString(@"CHIUDI", @"") forState:UIControlStateNormal]; self.chiudi.layer.borderWidth = 1; self.chiudi.layer.borderColor = [UIColor blackColor].CGColor; self.chiudi.layer.cornerRadius = 5; } -(void)condividiView{ } @end