Skip to content

Commit 16244b5

Browse files
Merge pull request #155 from Anuj-Raghuvanshi/master
Fixed Issues #95 - #95 #143 - #143
2 parents 4a8e6f6 + ce7ce9d commit 16244b5

File tree

3 files changed

+39
-22
lines changed

3 files changed

+39
-22
lines changed

src/ios/GMImagePicker/GMAlbumsViewCell.m

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3030
//self.textLabel.backgroundColor = self.backgroundColor;
3131
//self.detailTextLabel.backgroundColor = self.backgroundColor;
3232

33+
self.titleLabel.backgroundColor = self.backgroundColor;
34+
self.infoLabel.backgroundColor = self.backgroundColor;
35+
3336
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
3437

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

98101

99102
//TextLabel
100-
self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0];
101-
self.textLabel.numberOfLines = 1;
102-
self.textLabel.translatesAutoresizingMaskIntoConstraints = NO;
103+
// self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0];
104+
// self.textLabel.numberOfLines = 1;
105+
// self.textLabel.translatesAutoresizingMaskIntoConstraints = NO;
106+
107+
self.titleLabel = [UILabel new];
108+
self.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:17.0];
109+
self.titleLabel.numberOfLines = 1;
110+
self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
111+
self.titleLabel.adjustsFontSizeToFitWidth = YES;
112+
[self.contentView addSubview:self.titleLabel];
113+
114+
// self.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0];
115+
// self.detailTextLabel.numberOfLines = 1;
116+
// self.detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
103117

104-
self.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0];
105-
self.detailTextLabel.numberOfLines = 1;
106-
self.detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
118+
self.infoLabel = [UILabel new];
119+
self.infoLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14.0];
120+
self.infoLabel.numberOfLines = 1;
121+
self.infoLabel.translatesAutoresizingMaskIntoConstraints = NO;
122+
self.infoLabel.adjustsFontSizeToFitWidth = YES;
123+
[self.contentView addSubview:self.infoLabel];
107124

108125
//Set next text labels contraints :
109-
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[textLabel]-|"
126+
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[titleLabel]-|"
110127
options:0
111128
metrics:@{@"offset": @(kAlbumImageToTextSpace)}
112-
views:@{@"textLabel": self.textLabel,
129+
views:@{@"titleLabel": self.titleLabel,
113130
@"imageView1": self.imageView1}]];
114131

115-
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[detailTextLabel]-|"
132+
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView1]-(offset)-[infoLabel]-|"
116133
options:0
117134
metrics:@{@"offset": @(kAlbumImageToTextSpace)}
118-
views:@{@"detailTextLabel": self.detailTextLabel,
135+
views:@{@"infoLabel": self.infoLabel,
119136
@"imageView1": self.imageView1}]];
120137

121138

122-
[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.textLabel
139+
[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.titleLabel
123140
attribute:NSLayoutAttributeBottom
124141
relatedBy:NSLayoutRelationEqual
125-
toItem:self.textLabel.superview
142+
toItem:self.titleLabel.superview
126143
attribute:NSLayoutAttributeCenterY
127144
multiplier:1.f constant:0.f]]];
128145

129-
[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.detailTextLabel
146+
[self.contentView addConstraints:@[[NSLayoutConstraint constraintWithItem:self.infoLabel
130147
attribute:NSLayoutAttributeTop
131148
relatedBy:NSLayoutRelationEqual
132-
toItem:self.textLabel.superview
149+
toItem:self.titleLabel.superview
133150
attribute:NSLayoutAttributeCenterY
134151
multiplier:1.f constant:+4.f]]];
135152
}

src/ios/GMImagePicker/GMAlbumsViewController.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
262262
cell.tag = currentTag;
263263

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

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

270270
//Display the number of assets
271271
if(self.picker.displayAlbumsNumberOfAssets)
272272
{
273-
cell.detailTextLabel.text = [self tableCellSubtitle:assetsFetchResult];
273+
cell.infoLabel.text = [self tableCellSubtitle:assetsFetchResult];
274274
}
275275

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

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

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

443443

444444

445-
@end
445+
@end

src/ios/GMImagePicker/GMGridViewCell.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ - (id)initWithFrame:(CGRect)frame
6868
_imageView.contentMode = UIViewContentModeScaleAspectFill;
6969
}*/
7070
_imageView.clipsToBounds = YES;
71-
_imageView.translatesAutoresizingMaskIntoConstraints = NO;
72-
_imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
71+
//_imageView.translatesAutoresizingMaskIntoConstraints = NO;
72+
//_imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
7373
[self addSubview:_imageView];
7474

7575

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

217-
@end
217+
@end

0 commit comments

Comments
 (0)