Subversion Repository Public Repository

Nextrek

Diff Revisions 70 vs 71 for /iOS/StoryBoard/StoryBoard/VC/iPhone/DimensioneParallelaVC.m

Diff revisions: vs.
  @@ -12,9 +12,7 @@
12 12 #import "TableCellButton.h"
13 13 #import "AboutVC.h"
14 14
15 - @interface DimensioneParallelaVC (){
16 - Scena *scenaToShow;
17 - }
15 + @interface DimensioneParallelaVC ()
18 16
19 17 @end
20 18
  @@ -67,44 +65,23 @@
67 65
68 66 for(Scena *aScena in DATAMANAGER.scene) {
69 67 if(aScena.idScena - sceneId == 0) {
70 - scenaToShow = aScena;
68 + self.scenaToShow = aScena;
71 69 }
72 70 }
73 71
74 - self.bkgVImgView.image = [UIImage imageNamed:scenaToShow.bckImage];
72 + self.bkgVImgView.image = [UIImage imageNamed:self.scenaToShow.bckImage];
75 73
76 - if(!STR_ISNULL_OR_EMPTY(scenaToShow.testo)) {
77 - self.sceneText.hidden = NO;
78 - self.sceneText.text = scenaToShow.testo;
79 - [self.sceneText setContentOffset:CGPointMake(0, 0) animated:YES];
80 -
81 - CGRect frame = self.sceneText.frame;
82 - frame.size.height = self.sceneText.contentSize.height + 20;
83 -
84 - if(frame.size.height < 200) {
85 - self.sceneText.frame = frame;
86 - }
87 - else {
88 - self.sceneText.frame = IS_IPHONE_5 ? CGRectMake(5, 5, 470, frame.size.height + 20) : CGRectMake(5, 5, 470, frame.size.height + 20);
89 - }
90 - }
91 - else {
92 - self.sceneText.hidden = YES;
93 - }
94 -
95 - [self.sceneTable reloadData];
74 + self.sceneText.text = self.scenaToShow.testo;
75 + [self.sceneText setContentOffset:CGPointMake(0, 0) animated:NO];
76 + [self.sceneText setTextColor:[UIColor whiteColor]];
77 + [self.sceneText setFont:[UIFont systemFontOfSize:14.0f]];
96 78
97 - self.sceneTable.frame = IS_IPHONE_5 ? CGRectMake(124, 320 - (50*[scenaToShow.buttons count]), 320, 50*[scenaToShow.buttons count]) : CGRectMake(80, 320 - (50*[scenaToShow.buttons count]), 320, 50*[scenaToShow.buttons count]);
79 + [self.sceneButtonTable reloadData];
98 80
99 - CGRect frame = self.sceneText.frame;
100 - frame.size.height = self.sceneText.contentSize.height + 20;
81 + self.sceneButtonTable.frame = IS_IPHONE_5 ? CGRectMake(124, 320 - (50*[self.scenaToShow.buttons count]), 320, 50*[self.self.scenaToShow.buttons count]) : CGRectMake(80, 320 - (50*[self.scenaToShow.buttons count]), 320, 50*[self.scenaToShow.buttons count]);
101 82
102 - if(frame.size.height < 200) {
103 - self.sceneText.frame = frame;
104 - }
105 - else {
106 - self.sceneText.frame = IS_IPHONE_5 ? CGRectMake(5, 5, 470, frame.size.height + 20) : CGRectMake(5, 5, 470, frame.size.height + 20);
107 - }
83 + self.sceneText.hidden = STR_ISNULL_OR_EMPTY(self.scenaToShow.testo) ? YES : NO;
84 + self.sceneText.frame = IS_IPHONE_5 ? CGRectMake(5, 5, 560, 110) : CGRectMake(5, 5, 470, 110);
108 85 }
109 86
110 87 #pragma mark - Table view methods
  @@ -114,7 +91,7 @@
114 91 }
115 92
116 93 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
117 - return [scenaToShow.buttons count];
94 + return [self.scenaToShow.buttons count];
118 95 }
119 96
120 97 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  @@ -131,19 +108,24 @@
131 108 cell = [topLevelObjects objectAtIndex:0];
132 109 }
133 110
134 - SceneButton *sceneButton = ((SceneButton*)[scenaToShow.buttons objectAtIndex:indexPath.row]);
111 + SceneButton *sceneButton = ((SceneButton*)[self.scenaToShow.buttons objectAtIndex:indexPath.row]);
135 112 //NSLog(@"Testo bottone: %@", sceneButton.text);
136 113
137 - cell.button.titleLabel.numberOfLines = 1;
138 - cell.button.titleLabel.adjustsFontSizeToFitWidth = YES;
139 - cell.button.titleLabel.lineBreakMode = NSLineBreakByClipping;
114 + cell.button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
115 + cell.button.titleLabel.textAlignment = NSTextAlignmentCenter;
116 +
117 + cell.button.layer.cornerRadius = 8;
118 + cell.button.layer.masksToBounds = YES;
119 + cell.button.layer.borderWidth = 1;
120 + cell.button.layer.borderColor = [[UIColor grayColor] CGColor];
140 121
141 122 // buttonPreCond
142 123 // Vuol dire che se il l'elemento dell'array è "true" si vede il tasto con questa precodizione
143 124
144 125 if([sceneButton.preCond rangeOfString:@"evento(cell,true)"].location != NSNotFound) {
145 126 if(DATAMANAGER.sceneObject.eventoCellValue == NO) {
146 - cell.button.hidden = YES;
127 + // cell.button.hidden = YES;
128 + cell.button.hidden = NO;
147 129 cell.button.enabled = NO;
148 130 }
149 131 }
  @@ -152,7 +134,7 @@
152 134 cell.button.enabled = YES;
153 135 }
154 136
155 - [cell.button setTitle:((SceneButton*)[scenaToShow.buttons objectAtIndex:indexPath.row]).text forState:UIControlStateNormal];
137 + [cell.button setTitle:((SceneButton*)[self.scenaToShow.buttons objectAtIndex:indexPath.row]).text forState:UIControlStateNormal];
156 138
157 139 [cell.button addTarget:self action:@selector(buttonHighlight:) forControlEvents:UIControlEventTouchDown];
158 140 [cell.button addTarget:self action:@selector(doOpenNewScene:) forControlEvents:UIControlEventTouchUpInside];
  @@ -170,9 +152,9 @@
170 152 UIButton *button = (UIButton*)sender;
171 153
172 154 UITableViewCell *cell = (UITableViewCell *)button.superview.superview;
173 - NSIndexPath *indexPath = [self.sceneTable indexPathForCell:cell];
155 + NSIndexPath *indexPath = [self.sceneButtonTable indexPathForCell:cell];
174 156
175 - SceneButton *sceneButton = ((SceneButton*)[scenaToShow.buttons objectAtIndex:indexPath.row]);
157 + SceneButton *sceneButton = ((SceneButton*)[self.scenaToShow.buttons objectAtIndex:indexPath.row]);
176 158
177 159 if([sceneButton.targetId intValue] == 1001) {
178 160 AboutVC *aboutVC = [[AboutVC alloc] initWithNibName:nil bundle:nil];
  @@ -183,12 +165,7 @@
183 165 // buttonPostCond
184 166 // Vuol dire che dopo aver cliccato un tasto con questa postcondizione il primo elemento dell'array oggetti viene settata a "true"
185 167
186 - if([sceneButton.postCond rangeOfString:@"evento(cell,true)"].location != NSNotFound) {
187 - DATAMANAGER.sceneObject.eventoCellValue = YES;
188 - }
189 - else if([sceneButton.postCond rangeOfString:@"evento(cell,false)"].location != NSNotFound){
190 - DATAMANAGER.sceneObject.eventoCellValue = NO;
191 - }
168 + DATAMANAGER.sceneObject.eventoCellValue = [sceneButton.postCond rangeOfString:@"evento(cell,true)"].location != NSNotFound ? YES : NO;
192 169
193 170 DATAMANAGER.sceneObject.eventoLettoValue = [sceneButton.postCond rangeOfString:@"evento(letto,true)"].location != NSNotFound ? YES : NO;
194 171
  @@ -208,25 +185,15 @@
208 185
209 186 DATAMANAGER.sceneObject.oggettoBigliettoValue = [sceneButton.postCond rangeOfString:@"oggetto(biglietto,true)"].location != NSNotFound ? YES : NO;
210 187
211 -
212 188 [self showSceneView:[sceneButton.targetId intValue]];
213 189 }
214 190 }
215 191
216 -
217 - - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
218 -
219 - }
192 + - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { }
220 193
221 194 #pragma mark - Memory Managment
222 195
223 - - (void)didReceiveMemoryWarning {
224 - [super didReceiveMemoryWarning];
225 - }
226 -
227 - - (void)viewDidUnload {
228 - [super viewDidUnload];
229 - }
196 + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; }
230 197
231 198 @end
232 199