Friday, August 14, 2026
HomeiOS Developmentios - after I faucet filename button web page masses twice and...

ios – after I faucet filename button web page masses twice and a few of photos darkish or invisible

[ad_1]

I’m attempting to open information and see some photos are black or invisible. Whereas tapping filename button it entered twice or loading two occasions i’ve to press again or X. I’m utilizing iphone 12 professional and utilizing native server. I believe some photos usually are not decoding whereas importing to app or i don’t know what to do. Right here is my LocalFileImageDetailViewController.m `

(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
self.captureDetectedObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationUserDidTakeScreenshotNotification
                                                  object:nil
                                                   queue:mainQueue
                                              usingBlock:^(NSNotification *be aware) {
    UIAlertController *alert = [UIAlertController confirmAlertTitle:@"저작권 법적 고지" message:@"캡쳐된 스크린샷을 온라인, 오프라인 상에 유포 또는 공유할 경우 법적인 제재를 받을 수 있습니다."];;
    [AppDelegate.getMainView.navigationController presentViewController:alert animated:YES completion:nil];
                                              }];

[2]

self.rotateDetectedObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIDeviceOrientationDidChangeNotification
                                                  object:nil
                                                   queue:mainQueue
                                              usingBlock:^(NSNotification *be aware) {
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        [self updateFrame];
    });
                                              }];

[3]

IBAction)actionBack:(id)sender {
[self.navigationController popViewControllerAnimated:YES];

}

for (int i = 0; i < self.fileList.rely; i++) {
    __block UIImage* picture = nil;
    
    if ([self.ListType  isEqual: @"url"]) {
        NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: self.fileList[i]]];
        picture = [UIImage imageWithData: imageData];
    } else {
        NSString * filePath = (NSString *) self.fileList[i];
        NSString *imageFullPath = [self.filePath stringByAppendingPathComponent:filePath];
        BOOL isLoadAble = [[NSFileManager defaultManager] fileExistsAtPath:imageFullPath];
        if ( isLoadAble ) {
            picture = [UIImage imageWithContentsOfFile:imageFullPath];
        } else {
            //TODO 이미지가 없는경우 뭘 표시하나?
            proceed;

    
    UIScrollView *psv = [[UIScrollView alloc] initWithFrame:body];
    [psv setBackgroundColor:[UIColor blackColor]];
    psv.minimumZoomScale = ZOOM_MIN;
    psv.maximumZoomScale = ZOOM_MAX;
    psv.zoomScale = ZOOM_SCALE;
    psv.contentSize = imgV.bounds.measurement;

    psv.delegate = self.scrollDelegate;
    psv.showsHorizontalScrollIndicator = NO;
    psv.showsVerticalScrollIndicator = NO;

    [psv addSubview:imgV];
    [self.contentView addSubview:psv];
    
    [self.pages addObject:psv];


CGFloat width = self.scrollView.body.measurement.width;
CGFloat peak = self.contentView.body.measurement.peak;
CGRect innerFrame = CGRectMake(0, 0, width, peak);
CGSize contentSize = CGSizeMake(width, peak);

for (int i = 0; i < self.pages.rely; i++) {
    CGRect body = CGRectMake(i * width, 0, width, peak);
    
    UIScrollView *sv = (UIScrollView *)[self.pages objectAtIndex:i];
    sv.body = body;
    sv.contentSize = contentSize;
    sv.zoomScale = ZOOM_SCALE;
    for(UIView *view in sv.subviews){
      if(view.tag == VIEW_FOR_ZOOM_TAG){
          view.body = innerFrame;
      }
    }
}
[self.scrollView setContentSize:CGSizeMake(width * self.fileList.count, height)];
self.contentViewWidth.fixed = self.fileList.rely * width;
[self.scrollView setContentOffset:CGPointMake(width * self.index, 0) animated:NO];

}

float div = 0.15;
bool isMovePage = false;
if (self.index == 0 && offsetX < 0.0 - (width * div)) {// 1번이미지 - 1 = 마지막 이미지 이동
    [scrollView setContentOffset:CGPointMake(width * (self.fileList.count - 1), 0) animated:YES];
    isMovePage = true;
}
else if (self.index + 1 == self.fileList.rely && offsetX > width * (self.fileList.rely - 1) + (width * div)) {// 마지막 + 1 = 1번 이미지 이동
    [scrollView setContentOffset:CGPointMake(0, 0) animated:YES];
    isMovePage = true;
}

if (isMovePage) {
    int indexOfPage = scrollView.contentOffset.x / scrollView.body.measurement.width;
    self.index = indexOfPage;
    self.pageLabel.textual content = [NSString stringWithFormat:@"%d/%d", self.index+ 1, self.fileList.count];
}

}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments