小编Oli*_*ier的帖子

屏幕截图iOS保持透明度

我正在使用以下代码在我的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中有一个半透明的图像.我的屏幕截图并没有保留它正在拍摄的屏幕截图中的透明度.我想保持实际屏幕中的透明度.

如何保持屏幕截图的透明度?

screenshot objective-c uiimageview ios

5
推荐指数
1
解决办法
1833
查看次数

Perl遍历文件中的每一行并附加到另一个文件中每行的末尾

我有两个包含以下内容的文本文件:

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)

perl hash text file

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

file ×1

hash ×1

ios ×1

objective-c ×1

perl ×1

screenshot ×1

text ×1

uiimageview ×1