Skip to content
This repository has been archived by the owner on Feb 16, 2019. It is now read-only.

Commit

Permalink
Improve layout
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Oct 9, 2011
1 parent 19937bf commit 600465f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SSToolkit/SSCollectionView.m
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions SSToolkit/SSCollectionViewItem.m
Expand Up @@ -41,6 +41,7 @@ - (void)setBackgroundView:(UIView *)backgroundView {
_backgroundView.hidden = _selected || !_selectedBackgroundView;

[self insertSubview:backgroundView atIndex:0];
[self setNeedsLayout];
}


Expand All @@ -56,6 +57,8 @@ - (void)setSelectedBackgroundView:(UIView *)selectedBackgroundView {
} else {
[self insertSubview:_selectedBackgroundView atIndex:0];
}

[self setNeedsLayout];
}


Expand Down Expand Up @@ -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];
}
}
Expand All @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion SSToolkit/SSTableViewController.m
Expand Up @@ -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;
}


Expand Down

0 comments on commit 600465f

Please sign in to comment.