Skip to content
Browse files

Improve layout

  • Loading branch information...
1 parent 19937bf commit 600465f8eaada09cdd8abd66f4cdd5ee2a0c0146 @soffes soffes committed Oct 8, 2011
Showing with 10 additions and 4 deletions.
  1. +1 −1 SSToolkit/SSCollectionView.m
  2. +8 −2 SSToolkit/SSCollectionViewItem.m
  3. +1 −1 SSToolkit/SSTableViewController.m
View
2 SSToolkit/SSCollectionView.m
@@ -174,7 +174,7 @@ - (id)initWithFrame:(CGRect)frame {
_reuseableItems = [[NSMutableDictionary alloc] init];
_sectionCache = [[NSMutableDictionary alloc] init];
- _tableView = [[UITableView alloc] initWithFrame:CGRectSetZeroOrigin(frame)];
+ _tableView = [[UITableView alloc] initWithFrame:self.bounds];
_tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_tableView.dataSource = self;
_tableView.delegate = self;
View
10 SSToolkit/SSCollectionViewItem.m
@@ -41,6 +41,7 @@ - (void)setBackgroundView:(UIView *)backgroundView {
_backgroundView.hidden = _selected || !_selectedBackgroundView;
[self insertSubview:backgroundView atIndex:0];
+ [self setNeedsLayout];
}
@@ -56,6 +57,8 @@ - (void)setSelectedBackgroundView:(UIView *)selectedBackgroundView {
} else {
[self insertSubview:_selectedBackgroundView atIndex:0];
}
+
+ [self setNeedsLayout];
}
@@ -89,7 +92,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self setHighlighted:YES animated:NO];
- if (CGRectContainsPoint(CGRectSetZeroOrigin(self.frame), [[touches anyObject] locationInView:self])) {
+ if (CGRectContainsPoint(self.bounds, [[touches anyObject] locationInView:self])) {
[self.collectionView selectItemAtIndexPath:self.indexPath animated:YES scrollPosition:SSCollectionViewScrollPositionNone];
}
}
@@ -103,8 +106,11 @@ - (id)initWithFrame:(CGRect)frame {
- (void)layoutSubviews {
+ _backgroundView.frame = self.bounds;
+ _selectedBackgroundView.frame = self.bounds;
+
if (_style == SSCollectionViewItemStyleImage) {
- _imageView.frame = CGRectSetZeroOrigin(self.frame);
+ _imageView.frame = self.bounds;
}
}
View
2 SSToolkit/SSTableViewController.m
@@ -69,7 +69,7 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
- (void)layoutViewsWithOrientation:(UIInterfaceOrientation)orientation {
[super layoutViewsWithOrientation:orientation];
- self.tableView.frame = CGRectSetZeroOrigin(self.view.frame);
+ self.tableView.frame = self.view.bounds;
}

0 comments on commit 600465f

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