HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 更新:图像被捕获但不会显示大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > iOS 8 Snapshotting a view that has not been rendered results in an empty snapshot                                    20个
我有一些代码在处理我的某个应用程序;所以我复制了代码,进行了必要的更改(即textField名称等),除非我将其移动到UIImageView,否则它会起作用;没有出现.这是我的代码: @H_874_6@ @H_874_6@viewController.h(为简洁起见,仅显示相关部分)

@H_874_6@
#import "AppDelegate.h"
#import "Books.h"
#import <AVFoundation/AVFoundation.h>
#import "MBProgressHUD.h"
#import <MobileCoreservices/MobileCoreservices.h>
#import <UIKit/UIKit.h>

@class Books;

@interface DetailViewController : UIViewController <UITextFieldDelegate,UIPopoverControllerDelegate,UIPickerViewDatasource,UIPickerViewDelegate,UIActionSheetDelegate,UIScrollViewDelegate,UIImagePickerControllerDelegate,AVCaptureMetadataOutputObjectsDelegate>  {
}

//  UIView
@property (strong,nonatomiC) IBOutlet UIView *bookDetailView;

//  camera stuff
@property (strong,nonatomiC) IBOutlet UIImageView *oBookImage;
- (IBACtion)bOpenCamera:(UIButton *)sender;@H_607_11@ 
 @H_874_6@这是相关的viewController.m代码

@H_874_6@
#pragma mark -  Camera stuff
- (IBACtion)bOpenCamera:(UIButton *)sender {

if ([UIImagePickerController issourceTypeAvailable: UIImagePickerControllersourceTypeCamera])  {

    UIImagePickerController *imagePicker = [UIImagePickerController new];
    imagePicker.sourCEType = UIImagePickerControllersourceTypeCamera;
    imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeImage,nil];
    imagePicker.allowsEdiTing = YES;  //  MUST HAVE!

    [imagePicker setDelegate: (id)self];
    [self presentViewController:imagePicker animated:YES completion:nil];
}

}

-(void)image:(UIImage *)image finishedSavingWithError:(NSError *)error contexTinfo:(@R_262_6543@)contexTinfo  {

if (error) {
    CommonMethods *cm = [CommonMethods new];
    [cm displayAlert:@"Warning!" andData:@"Failed to save book image..." andTag:0 andViewController:self];
}
}


-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info  {

self.oBookImage.contentMode = UIViewContentModeScaleAspectFill;

NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
[self dismissviewControllerAnimated:NO completion:nil];

if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {  //  (abstract image data)

    UIImage *image =  [info objectForKey:UIImagePickerControllerOriginalImage];

    //  resize it...
    CGRect screenRect = CGRectMake(0,114.0,128.0);  //  was 90.0,120.0
    UIGraphicsBeginImageContext(screenRect.sizE);
    [image drawInRect:screenRect blendMode:kCGBlendModePlusDarker alpha:1];

    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    oBookImage.image = newImage;  //  show it...

}
}

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker  {

[self dismissviewControllerAnimated:NO completion:nil];
}@H_607_11@ 
 @H_874_6@更新:在捕获图像时的某个时刻,我收到此警告:

@H_874_6@ @H_874_6@也许这与它有关?我试图纠正警告,无济于事.

@H_874_6@我在Google和SO中寻找过类似的问题,但一无所获.我已经为此工作了两天,并决定是时候寻求帮助了.提前致谢.

@H_874_6@SD

解决方法

我也得到了这个问题.经过几个小时的研究,我遇到了这个: iOS8 Snapshotting a view that has not been rendered results in an empty snapshot @H_874_6@ @H_874_6@也许最后的答案可以帮到你?希望如此.如果没有,那么它可能只是一个错误.

大佬总结

以上是大佬教程为你收集整理的ios – 更新:图像被捕获但不会显示全部内容,希望文章能够帮你解决ios – 更新:图像被捕获但不会显示所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。