Skip to content

Commit

Permalink
Merge pull request sarriaroman#179 from sithwarrior/master
Browse files Browse the repository at this point in the history
Fix missing label on iOS
  • Loading branch information
sarriaroman authored Jul 15, 2019
2 parents c5a566e + 8767d39 commit a125148
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ios/PhotoViewer.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ @interface PhotoViewer : CDVPlugin <UIDocumentInteractionControllerDelegate, UIS
UIScrollView *fullView;
UIImageView *imageView;
UIButton *closeBtn;
UILabel *imageLabel;
BOOL showCloseBtn;
BOOL copyToReference;
NSDictionary *headers;
Expand Down Expand Up @@ -225,9 +226,25 @@ - (void)showFullScreen:(NSURL *)url andTitle:(NSString *)title {
closeBtn.titleLabel.font = [UIFont systemFontOfSize: 32];
[closeBtn setTitleColor:[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.6] forState:UIControlStateNormal];
[closeBtn setFrame:CGRectMake(0, viewHeight - 50, viewWidth, 50)];
closeBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
closeBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
[closeBtn setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.6]];
[closeBtn addTarget:self action:@selector(closeButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.viewController.view addSubview:closeBtn];

imageLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, viewHeight - 50, viewWidth - 120, 50)];
imageLabel.numberOfLines = 0;
imageLabel.lineBreakMode = NSLineBreakByWordWrapping;
imageLabel.minimumScaleFactor = 0.5;
imageLabel.adjustsFontSizeToFitWidth = YES;

[imageLabel setTextAlignment:NSTextAlignmentCenter];
[imageLabel setTextColor:[UIColor whiteColor]];
[imageLabel setBackgroundColor:[UIColor clearColor]];
[imageLabel setFont:[UIFont fontWithName: @"San Fransisco" size: 14.0f]];
[imageLabel setText:title];
[self.viewController.view addSubview:imageLabel];

} else {
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(fullimagetapped:)];
singleTap.numberOfTapsRequired = 1;
Expand All @@ -243,7 +260,10 @@ - (void)fullimagetapped:(UIGestureRecognizer *)gestureRecognizer {

- (void)closeButtonPressed:(UIButton *)button {
[closeBtn removeFromSuperview];
[imageLabel removeFromSuperview];

closeBtn = nil;
imageLabel = nil;
[self closeImage];
}

Expand Down

0 comments on commit a125148

Please # to comment.