我有一些代码正在处理我的某个应用程序;所以我复制了代码,进行了必要的更改(即textFIEld名称等),除非我将其移动到UIImageVIEw,否则它会起作用;没有出现.这是我的代码:
vIEwController.h(为简洁起见,仅显示相关部分)
#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;
这是相关的vIEwController.m代码:
#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:(voID *)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];}
更新:在捕获图像时的某个时刻,我收到此警告:
Snapshotting a vIEw that has not been rendered results in an empty snapshot. Ensure your vIEw has been rendered at least once before snapshotting or snapshot after screen updates.
也许这与它有关?我试图纠正警告,无济于事.
我在Google和SO中寻找过类似的问题,但一无所获.我已经为此工作了两天,并决定是时候寻求帮助了.提前致谢.
SD
解决方法 我也得到了这个问题.经过几个小时的研究,我遇到了这个: iOS8 Snapshotting a view that has not been rendered results in an empty snapshot也许最后的答案可以帮到你?希望如此.如果没有,那么它可能只是一个错误.
总结以上是内存溢出为你收集整理的ios – 更新:图像被捕获但不会显示全部内容,希望文章能够帮你解决ios – 更新:图像被捕获但不会显示所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)