Subversion Repository Public Repository

Nextrek

Diff Revisions 683 vs 684 for /iOS/SafariArte/trunk/SafariArte/Commodities/SWRevealViewController/RouteQuestionsVC/RouteQuestionsVC.m

Diff revisions: vs.
  @@ -40,8 +40,25 @@
40 40 self.percorsoQuestion = [self.routeForDetail.questions objectAtIndex:[self.questionIndex intValue]];
41 41
42 42 // [self.questionImage setImageWithURL:[NSURL URLWithString:self.percorsoQuestion.fileImage]];
43 +
44 +
45 + NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:self.percorsoQuestion.fileImage]
46 + cachePolicy:NSURLRequestReturnCacheDataElseLoad
47 + timeoutInterval:30.0f];
48 +
49 + [self.questionImage setImageWithURLRequest:imageRequest placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
50 +
51 + [self.questionImage setImage:[DATAMANAGER imageWithImage:image scaledToWidth:[[UIScreen mainScreen] bounds].size.width]];
52 +
53 + } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
54 + nil;
55 + }];
56 +
43 57
44 - [self.questionImage setImage:[DATAMANAGER imageWithImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.percorsoQuestion.fileImage]]] scaledToWidth:[[UIScreen mainScreen] bounds].size.width]];
58 +
59 +
60 + //
61 + // [self.questionImage setImage:[DATAMANAGER imageWithImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.percorsoQuestion.fileImage]]] scaledToWidth:[[UIScreen mainScreen] bounds].size.width]];
45 62
46 63 self.questionLabel.text=self.percorsoQuestion.label;
47 64 [self.navigationItem setHidesBackButton:YES];
  @@ -52,7 +69,7 @@
52 69 -(void) viewWillAppear:(BOOL)animated{
53 70
54 71 [super viewWillAppear:animated];
55 -
72 +
56 73 if (player) {
57 74 [player play];
58 75 }
  @@ -74,7 +91,6 @@
74 91
75 92 [self timerStop];
76 93
77 -
78 94 [self.questionImage setContentMode:UIViewContentModeScaleAspectFit];
79 95
80 96 // [DATAMANAGER saveTimerForRouteID:self.routeForDetail];
  @@ -131,8 +147,22 @@
131 147
132 148 if (![self.questionIndex isEqualToNumber:[NSNumber numberWithInteger:[self.routeForDetail.questions count]-1]]) { self.questionIndex = [NSNumber numberWithInt:[self.questionIndex intValue]+1];
133 149 self.percorsoQuestion = [self.routeForDetail.questions objectAtIndex:[self.questionIndex intValue]];
134 - [self.questionImage setImageWithURL:[NSURL URLWithString:self.percorsoQuestion.fileImage]];
135 - self.questionLabel.text = self.percorsoQuestion.label;
150 +
151 +
152 + NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:self.percorsoQuestion.fileImage]
153 + cachePolicy:NSURLRequestReturnCacheDataElseLoad
154 + timeoutInterval:30.0f];
155 +
156 + [self.questionImage setImageWithURLRequest:imageRequest placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
157 +
158 + [self.questionImage setImage:[DATAMANAGER imageWithImage:image scaledToWidth:[[UIScreen mainScreen] bounds].size.width]];
159 +
160 + } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
161 + nil;
162 + }];
163 +
164 +
165 + self.questionLabel.text = self.percorsoQuestion.label;
136 166
137 167 [self playSoundWithPath:@"ticchettio" withLoop:YES];
138 168