Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Small fix to the demo

  • Loading branch information...
commit 2b48dac9b602f906704a4b581917b6b6edb4817a 1 parent 197b7b6
Xinrong Guo authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 BookShelf/ViewController.m
4 BookShelf/ViewController.m
@@ -54,7 +54,7 @@ - (void)initBooks {
54 54 _bookArray = [[NSMutableArray alloc] initWithCapacity:numberOfBooks];
55 55 _bookStatus = [[NSMutableArray alloc] initWithCapacity:numberOfBooks];
56 56 for (int i = 0; i < numberOfBooks; i++) {
57   - NSNumber *number = [NSNumber numberWithInt:i];
  57 + NSNumber *number = [NSNumber numberWithInt:i % 4 + 1];
58 58 [_bookArray addObject:number];
59 59 [_bookStatus addObject:[NSNumber numberWithInt:BOOK_UNSELECTED]];
60 60 }
@@ -157,7 +157,7 @@ - (UIView *)bookShelfView:(GSBookShelfView *)bookShelfView bookViewAtIndex:(NSIn
157 157 }
158 158 [bookView setIndex:index];
159 159 [bookView setSelected:[(NSNumber *)[_bookStatus objectAtIndex:index] intValue]];
160   - int imageNO = [(NSNumber *)[_bookArray objectAtIndex:index] intValue] % 4 + 1;
  160 + int imageNO = [(NSNumber *)[_bookArray objectAtIndex:index] intValue];
161 161 [bookView setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.png", imageNO]] forState:UIControlStateNormal];
162 162 return bookView;
163 163 }

0 comments on commit 2b48dac

Please sign in to comment.
Something went wrong with that request. Please try again.