// // InformazioniViewController.m // Earthquake Network // // Created by Luca Beretta on 11/02/2019. // Copyright © 2019 Luca Beretta. All rights reserved. // #import "InformazioniViewController.h" @interface InformazioniViewController () @property (weak, nonatomic) IBOutlet UITextView *testo; @end @implementation InformazioniViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. UIView *viewNavigationBar = [[UIView alloc] initWithFrame:CGRectMake(-18, 5, 190, 44)]; UIImageView *imageLogo = [[UIImageView alloc] initWithFrame:CGRectMake(-18, 5, 38, 38)]; imageLogo.image = [UIImage imageNamed:@"distquake_app_wave"]; [viewNavigationBar addSubview:imageLogo]; UILabel *textForNavi = [[UILabel alloc] initWithFrame:CGRectMake(25, 5, 180, 38)]; UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"chiudi", @"") style:UIBarButtonItemStyleDone target:self action:@selector(chiudi:)]; self.navigationItem.rightBarButtonItems = @[item1]; NSString *nameFile = @""; switch (self.index.row) { case 2: nameFile = @"info"; break; case 3: nameFile = @"faq"; break; case 4: nameFile = @"disclaimer"; break; case 5: nameFile = @"author"; break; case 6: nameFile = @"privacy"; break; default: break; } textForNavi.text = [nameFile uppercaseString]; [viewNavigationBar addSubview:textForNavi]; self.navigationItem.titleView = viewNavigationBar; self.testo.text = [self testWithFileName:nameFile]; } -(NSString *)testWithFileName:(NSString *)name{ NSString* path = [[NSBundle mainBundle] pathForResource:name ofType:@"txt"]; NSString* content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]; return content; } -(void)chiudi:(id)sender{ [self dismissViewControllerAnimated:YES completion:nil]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end