Nextrek
@ 1145
Nextrek / iOS / Emmanuele Rossi / REWORKMostri / NewMostri / VC / MenuVC / MenuVC.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
// // MenuVC.m // NewMostri // // Created by DBraccini_Nextrek on 30/08/2019. // Copyright © 2019 Nextrek. All rights reserved. // #import "MenuVC.h" #import "../Indice/IndiceVC.h" #import "MenuCell/MenuCell.h" #import <Foundation/Foundation.h> #import "../../../DataManager.h" #import "../Info/Info.h" #import "../Personaggi/PersonaggiVC.h" @interface MenuVC () { // UITextField *alertTextField; IBOutlet UITableView *tableView; } @end @implementation MenuVC @synthesize backToChapterBtn; @synthesize menuItems; - (void)viewDidLoad { [super viewDidLoad]; [self createMenuItems]; // [DATAMANAGER loadExtraState]; } - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // backToChapterBtn.hidden = !DATAMANAGER.isReading; } - (IBAction)doBackToChapter { // [self.navigationController pushViewController:[DATAMANAGER backToReaderView:DATAMANAGER.readingChapter] animated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (IBAction)doTCVCButton { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *menuVC = (UIViewController*)[storyboard instantiateViewControllerWithIdentifier:@"TCVC"]; [self presentViewController:menuVC animated:YES completion:nil]; [UIView beginAnimations:@"animation" context:nil]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO]; [UIView setAnimationDuration: 0.7]; [UIView commitAnimations]; NSLog(@"Completed Presenting correctViewController"); } - (IBAction)doInfoButton { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *menuVC = (UIViewController*)[storyboard instantiateViewControllerWithIdentifier:@"InfoVC"]; [self presentViewController:menuVC animated:YES completion:nil]; [UIView beginAnimations:@"animation" context:nil]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO]; [UIView setAnimationDuration: 0.7]; [UIView commitAnimations]; NSLog(@"Completed Presenting correctViewController"); } #pragma mark - #pragma mark Menu Items - (void) createMenuItems { menuItems = [NSMutableArray array]; [menuItems addObject:@"ASCOLTA I MOSTRI"]; [menuItems addObject:@"GUARDA I MOSTRI"]; [menuItems addObject:@"AUTORI"]; [menuItems addObject:@"EXTRA"]; } #pragma mark - #pragma mark Table view methods - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [menuItems count]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 55; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MenuCell"; MenuCell *cell = (MenuCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:MyIdentifier owner:self options:nil]; cell = [topLevelObjects objectAtIndex:0]; } [cell setGrayAndWhiteAlternateRow:indexPath.row]; NSString *stringForCell = [menuItems objectAtIndex:indexPath.row]; cell.cellLabel.text = stringForCell; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.row) { case 0: { [self performSegueWithIdentifier:@"showIndexVC" sender:self]; break; } case 1: { PersonaggiVC *personaggiVC = [[PersonaggiVC alloc]initWithNibName:@"PersonaggiVC" bundle:nil]; [self.navigationController pushViewController:personaggiVC animated:YES]; break; } case 2: { // MusicheVC *musicheVC = [[MusicheVC alloc]initWithNibName:@"MusicheVC" bundle:nil]; // [self.navigationController pushViewController:musicheVC animated:YES]; break; } case 3: { // if(DATAMANAGER.isAllFound) { // ScratchVCViewController *scratchVCViewController = [[ScratchVCViewController alloc]initWithNibName:@"ScratchVCViewController" bundle:nil]; // [self.navigationController pushViewController:scratchVCViewController animated:YES]; // } // else { // [self showAlert:@"Completa le rime - 1" // message:@"Non sapete come son fatti alcuni Mostri?\n Siete sicuri che siano fatti .... ? \n\n\n" tag:1]; // } // break; } default: break; } [tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:NO]; } //- (void) showAlert:(NSString*)aTitle message:(NSString*)aMessage tag:(int)aTag { // UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle: aTitle // message:aMessage.length == 0 ? @" " : aMessage // delegate:self // cancelButtonTitle:@"Annulla" // otherButtonTitles:@"OK", nil]; // alertTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 115.0, 260.0, 25.0)]; // [alertTextField setBackgroundColor:[UIColor whiteColor]]; // [alertTextField setSecureTextEntry:NO]; // [myAlertView addSubview:alertTextField]; // [alertTextField becomeFirstResponder]; // myAlertView.tag = aTag; // [myAlertView show]; //} #pragma mark Alert view method //- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { // [alertTextField resignFirstResponder]; // // if(buttonIndex != 0) { // if(actionSheet.tag == 1){ // if([[alertTextField.text lowercaseString] isEqualToString:@"vostri"]) { // DATAMANAGER.isAllFound = NO; // [DATAMANAGER saveExtraState]; // // [self showAlert:@"Completa le rime - 2" // message:@"Di uno è curioso il nome: Lo Strambuto!\n Sarà perché il suo verso è lo ... \n\n\n" // tag:2]; // } // else { // DATAMANAGER.isAllFound = NO; // [DATAMANAGER saveExtraState]; // // UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Rima errata, ritenta" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; // [myAlertView show]; // } // } // else if(actionSheet.tag == 2){ // if([[alertTextField.text lowercaseString] isEqualToString:@"starnuto"]) { // DATAMANAGER.isAllFound = NO; // [DATAMANAGER saveExtraState]; // // [self showAlert:@"Completa le rime - 3" // message:@"E per finire, andiamo a scoprire chi manca mentre stiamo seduti comodi sopra una \n\n\n" // tag:3]; // } // else { // DATAMANAGER.isAllFound = NO; // [DATAMANAGER saveExtraState]; // // UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Rima errata, ritenta" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; // [myAlertView show]; // } // } // else if(actionSheet.tag == 3){ // if([[alertTextField.text lowercaseString] isEqualToString:@"panca"]) { // DATAMANAGER.isAllFound = YES; // [DATAMANAGER saveExtraState]; // // ScratchVCViewController *scratchVCViewController = [[ScratchVCViewController alloc]initWithNibName:@"ScratchVCViewController" bundle:nil]; // [self.navigationController pushViewController:scratchVCViewController animated:YES]; // } // else { // // DATAMANAGER.isAllFound = NO; // [DATAMANAGER saveExtraState]; // // UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Rima errata, ritenta" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; // [myAlertView show]; // } // } // } //} @end |
Commits for Nextrek/iOS/Emmanuele Rossi/REWORKMostri/NewMostri/VC/MenuVC/MenuVC.m
Revision | Author | Commited | Message |
---|---|---|---|
1145 Diff | DBraccini | Thu 05 Sep, 2019 15:28:59 +0000 | tentativo aggiunta pagina Personaggi |
1140 Diff | DBraccini | Wed 04 Sep, 2019 13:55:52 +0000 | add indiceCV and indiceCell |
1136 Diff | LDademo | Tue 03 Sep, 2019 15:59:54 +0000 | InfoVC reference ready |
1135 Diff | DBraccini | Tue 03 Sep, 2019 15:48:38 +0000 | wip infoWC |
1134 | LDademo | Tue 03 Sep, 2019 15:00:07 +0000 | Rework dell’audiolibro “Mostri” di Emmanuele Rossi |