Commits

p2  committed 051d1a1

Make the background cover the underlying table view.

  • Participants
  • Parent commits 06d674b

Comments (0)

Files changed (3)

File ThumbScrolling/MasterViewController.m

 	_titles = [NSMutableArray new];
 	NSUInteger i = 0;
 	NSUInteger used = 0;
-	NSUInteger every = 10;
+	NSUInteger every = 7;
 	NSMutableString *currentFirst = [NSMutableString string];
 	NSMutableArray *section = [NSMutableArray arrayWithCapacity:50];
 	

File ThumbScrolling/PPTSRowView.m

 - (CATransform3D)transformForFocusY:(CGFloat)focusY inBubble:(CGFloat)bubbleSize withDensity:(CGFloat)density
 {
 	CGFloat expFraction = [self fractionForFocusY:focusY withDensity:density];
+	CGFloat myHeight = [self bounds].size.height;
 	
 	// calculate fold amount (smooth between 0.1 and 0.9)
 	CGFloat foldAmount = 0.9f;
 	
 	// create a transformation
 	CATransform3D t = CATransform3DIdentity;
-	t.m34 = 1.f / (-3 * [self bounds].size.height);
+	t = CATransform3DMakeTranslation(0.f, 0.f, myHeight/2);
+	t.m34 = 1.f / (-3 * myHeight);
 	t = CATransform3DRotate(t, -M_PI_2 * foldAmount, 1.f, 0.f, 0.f);
 	CGFloat scale = 0.89f + (expFraction * 0.07f);
 	t = CATransform3DScale(t, scale, scale, 1.f);
 	CGContextRef ctx = UIGraphicsGetCurrentContext();
 	CGContextSaveGState(ctx);
 	
-	// fill
-	CGContextSetFillColorWithColor(ctx, [self.backgroundColor CGColor]);
-	CGContextFillRect(ctx, [self bounds]);
+	CGRect myBounds = [self bounds];
 	
-	// top border
-	CGRect top = [self bounds];
-	top.size.height = 1.f;
+	// fill with border color
 	CGContextSetFillColorWithColor(ctx, [[UIColor lightGrayColor] CGColor]);
-	CGContextFillRect(ctx, top);
+	CGContextFillRect(ctx, myBounds);
+	
+	// fill with white to leave left, top and right border
+	CGRect fill = CGRectInset(myBounds, 1.f, 1.f);
+	fill.size.height += 1.f;
+	CGContextSetFillColorWithColor(ctx, [self.backgroundColor CGColor]);
+	CGContextFillRect(ctx, fill);
 	
 	// add text
 	if ([text length] > 0) {

File ThumbScrolling/PPTSView.m

 - (id)initWithFrame:(CGRect)aFrame
 {
     if ((self = [super initWithFrame:aFrame])) {
-		self.backgroundColor = [UIColor colorWithWhite:0.f alpha:0.25f];
+		self.backgroundColor = [UIColor whiteColor];
 		bubbleSize = 80.f;
+		
+		// fake box bottom
+		CGRect bottomFrame = CGRectInset([self bounds], 30.f, 20.f);
+		UIView *bottom = [[UIView alloc] initWithFrame:bottomFrame];
+		bottom.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+		bottom.layer.borderColor = [[UIColor lightGrayColor] CGColor];
+		bottom.layer.borderWidth = 1.f;
+		[self addSubview:bottom];
     }
     return self;
 }