diff --git a/SSToolkit/SSCollectionView.m b/SSToolkit/SSCollectionView.m index 19cd8a8..a4e36aa 100644 --- a/SSToolkit/SSCollectionView.m +++ b/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; diff --git a/SSToolkit/SSCollectionViewItem.m b/SSToolkit/SSCollectionViewItem.m index 5db2070..ca0db7b 100644 --- a/SSToolkit/SSCollectionViewItem.m +++ b/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; } } diff --git a/SSToolkit/SSTableViewController.m b/SSToolkit/SSTableViewController.m index 92b656f..4f58259 100644 --- a/SSToolkit/SSTableViewController.m +++ b/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; }