Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve layout

  • Loading branch information...
commit 600465f8eaada09cdd8abd66f4cdd5ee2a0c0146 1 parent 19937bf
@soffes soffes authored
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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.