我正在使用以下代码在我的Xib文件中截取特定视图的屏幕截图...
UIView* captureView = self.view;
UIGraphicsBeginImageContextWithOptions(captureView.bounds.size, NO , 0.0f);
[captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
Run Code Online (Sandbox Code Playgroud)
它工作正常,并将JPG图像保存到相机胶卷.
但问题是,在我的View顶部还有另一个UIImageView,UIImageView中有一个半透明的图像.我的屏幕截图并没有保留它正在拍摄的屏幕截图中的透明度.我想保持实际屏幕中的透明度.
如何保持屏幕截图的透明度?
我有两个包含以下内容的文本文件:
FILE1.TXT
dog
cat
antelope
Run Code Online (Sandbox Code Playgroud)
FILE2.TXT
1
2
Barry
Run Code Online (Sandbox Code Playgroud)
我想要实现的输出如下:
dog1
dog2
dogBarry
cat1
cat2
catBarry
antelope1
antelope2
antelopeBarry
Run Code Online (Sandbox Code Playgroud)
他们这样做了我:
open (FILE1, "<File1.txt") || die $!;
open (FILE2, "<File2.txt") || die $!;
my @animals = (<FILE1>); #each line of the file into an array
my @otherStrings = (<FILE2>); #each line of the file into an array
close FILE1 || die $!;
close FILE2 || die $!;
my @bothTogether;
foreach my $animal (@animals) {
chomp $animal;
foreach my $otherString (@otherStrings) { …Run Code Online (Sandbox Code Playgroud)