Skip to content

Commit

Permalink
Merge pull request #155 from Anuj-Raghuvanshi/master
Browse files Browse the repository at this point in the history
Fixed Issues
 #95 - #95
#143 - #143
  • Loading branch information
anujraghuvanshi authored Apr 30, 2019
2 parents 4a8e6f6 + ce7ce9d commit 16244b5
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 22 deletions.
45 changes: 31 additions & 14 deletions src/ios/GMImagePicker/GMAlbumsViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
//self.textLabel.backgroundColor = self.backgroundColor;
//self.detailTextLabel.backgroundColor = self.backgroundColor;

self.titleLabel.backgroundColor = self.backgroundColor;
self.infoLabel.backgroundColor = self.backgroundColor;

self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

//Border width of 1 pixel:
Expand Down Expand Up @@ -97,39 +100,53 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus


//TextLabel
self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0];
self.textLabel.numberOfLines = 1;
self.textLabel.translatesAutoresizingMaskIntoConstraints = NO;
// self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0];
// self.textLabel.numberOfLines = 1;
// self.textLabel.translatesAutoresizingMaskIntoConstraints = NO;

self.titleLabel = [UILabel new];
self.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:17.0];
self.titleLabel.numberOfLines = 1;
self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
self.titleLabel.adjustsFontSizeToFitWidth = YES;
[self.contentView addSubview:self.titleLabel];

// self.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0];
// self.detailTextLabel.numberOfLines = 1;
// self.detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO;

self.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0];
self.detailTextLabel.numberOfLines = 1;
self.detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
self.infoLabel = [UILabel new];
self.infoLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14.0];
self.infoLabel.numberOfLines = 1;
self.infoLabel.translatesAutoresizingMaskIntoConstraints = NO;
self.infoLabel.adjustsFontSizeToFitWidth = YES;
[self.contentView addSubview:self.infoLabel];

//Set next text labels contraints :
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[textLabel]-|"
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[titleLabel]-|"
options:0
metrics:@{@"offset": @(kAlbumImageToTextSpace)}
views:@{@"textLabel": self.textLabel,
views:@{@"titleLabel": self.titleLabel,
@"imageView1": self.imageView1}]];

[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[detailTextLabel]-|"
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[infoLabel]-|"
options:0
metrics:@{@"offset": @(kAlbumImageToTextSpace)}
views:@{@"detailTextLabel": self.detailTextLabel,
views:@{@"infoLabel": self.infoLabel,
@"imageView1": self.imageView1}]];


[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.textLabel
[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.titleLabel
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.textLabel.superview
toItem:self.titleLabel.superview
attribute:NSLayoutAttributeCenterY
multiplier:1.f constant:0.f]]];

[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.detailTextLabel
[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.infoLabel
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.textLabel.superview
toItem:self.titleLabel.superview
attribute:NSLayoutAttributeCenterY
multiplier:1.f constant:+4.f]]];
}
Expand Down
10 changes: 5 additions & 5 deletions src/ios/GMImagePicker/GMAlbumsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.tag = currentTag;

//Set the label
cell.textLabel.text = (self.collectionsFetchResultsTitles[indexPath.section])[indexPath.row];
cell.titleLabel.text = (self.collectionsFetchResultsTitles[indexPath.section])[indexPath.row];

//Retrieve the pre-fetched assets for this album:
PHFetchResult *assetsFetchResult = (self.collectionsFetchResultsAssets[indexPath.section])[indexPath.row];

//Display the number of assets
if(self.picker.displayAlbumsNumberOfAssets)
{
cell.detailTextLabel.text = [self tableCellSubtitle:assetsFetchResult];
cell.infoLabel.text = [self tableCellSubtitle:assetsFetchResult];
}

//Set the 3 images (if exists):
Expand Down Expand Up @@ -353,12 +353,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
GMAlbumsViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

//Init the GMGridViewController
GMGridViewController *gridViewController = [[GMGridViewController alloc] initWithPicker:[self picker]];
//Set the title
gridViewController.title = cell.textLabel.text;
gridViewController.title = cell.titleLabel.text;
//Use the prefetched assets!
gridViewController.assetsFetchResults = [[_collectionsFetchResultsAssets objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
gridViewController.dic_asset_fetches = dic_asset_fetches;
Expand Down Expand Up @@ -442,4 +442,4 @@ - (NSString *)tableCellSubtitle:(PHFetchResult*)assetsFetchResult



@end
@end
6 changes: 3 additions & 3 deletions src/ios/GMImagePicker/GMGridViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ - (id)initWithFrame:(CGRect)frame
_imageView.contentMode = UIViewContentModeScaleAspectFill;
}*/
_imageView.clipsToBounds = YES;
_imageView.translatesAutoresizingMaskIntoConstraints = NO;
_imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
//_imageView.translatesAutoresizingMaskIntoConstraints = NO;
//_imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[self addSubview:_imageView];


Expand Down Expand Up @@ -214,4 +214,4 @@ -(NSString*)getDurationWithFormat:(NSTimeInterval)duration
return [NSString stringWithFormat:@"%02ld:%02ld", (long)minutes, (long)seconds];
}

@end
@end

0 comments on commit 16244b5

Please sign in to comment.