Skip to content
Browse files

Fix setting the selectionGradient size when rowHeight is changed.

  • Loading branch information...
1 parent ae330df commit 55bde724347cc64f4eb37b5b375da8fca3b53910 @bjhomer committed
Showing with 12 additions and 16 deletions.
  1. +6 −6 Classes/HSImageSidebarView.m
  2. +1 −0 Classes/SidebarViewController.m
  3. +5 −10 en.lproj/SidebarViewController.xib
View
12 Classes/HSImageSidebarView.m
@@ -121,12 +121,6 @@ - (void) setupViewHierarchy {
UIColor *topColor = [baseColor colorWithAlphaComponent:1];
UIColor *bottomColor = [baseColor colorWithAlphaComponent:0.75];
selectionGradient.colors = [NSArray arrayWithObjects:(id)[topColor CGColor], (id)[bottomColor CGColor], nil];
- if (isHorizontal) {
- selectionGradient.bounds = CGRectMake(0, 0, rowHeight, _scrollView.bounds.size.height);
- }
- else {
- selectionGradient.bounds = CGRectMake(0, 0, _scrollView.bounds.size.width, rowHeight);
- }
selectionGradient.hidden = YES;
[_scrollView.layer addSublayer:selectionGradient];
@@ -230,6 +224,12 @@ - (void)layoutSubviews {
forKey:kCATransactionDisableActions];
selectionGradient.hidden = NO;
+ if (isHorizontal) {
+ selectionGradient.bounds = CGRectMake(0, 0, rowHeight, _scrollView.bounds.size.height);
+ }
+ else {
+ selectionGradient.bounds = CGRectMake(0, 0, _scrollView.bounds.size.width, rowHeight);
+ }
selectionGradient.position = [self imageViewCenterInScrollViewForIndex:selectedIndex];
[CATransaction commit];
View
1 Classes/SidebarViewController.m
@@ -41,6 +41,7 @@ - (void)loadView {
- (void)viewDidLoad {
[super viewDidLoad];
_sidebar.delegate = self;
+ _sidebar.rowHeight = 240;
colors = [[NSMutableArray alloc] init];
View
15 en.lproj/SidebarViewController.xib
@@ -30,9 +30,8 @@
<object class="IBUIView" id="752737248">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">290</int>
- <string key="NSFrameSize">{768, 85}</string>
+ <string key="NSFrame">{{0, 39}, {768, 256}}</string>
<reference key="NSSuperview" ref="766721923"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="798373514"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
@@ -43,10 +42,8 @@
<object class="IBUIButton" id="496310911">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{397, 241}, {194, 37}}</string>
+ <string key="NSFrame">{{400, 350}, {194, 37}}</string>
<reference key="NSSuperview" ref="766721923"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
@@ -74,9 +71,8 @@
<object class="IBUIButton" id="798373514">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{155, 241}, {194, 37}}</string>
+ <string key="NSFrame">{{158, 350}, {194, 37}}</string>
<reference key="NSSuperview" ref="766721923"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="496310911"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -95,7 +91,6 @@
</array>
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="752737248"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
@@ -171,8 +166,8 @@
<reference key="object" ref="766721923"/>
<array class="NSMutableArray" key="children">
<reference ref="752737248"/>
- <reference ref="798373514"/>
<reference ref="496310911"/>
+ <reference ref="798373514"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -228,7 +223,7 @@
</dictionary>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">sidebar</string>
- <string key="NS.object.0">HSImageSidebarView</string>
+ <string key="NS.object.0">id</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>

0 comments on commit 55bde72

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