偶然 一次 看到 黑客 攻擊的演示視頻,頓時(shí)感覺(jué)好酷啊,這才是程序員京髓,才是我輩楷模呀...
我也想這樣...
但是技術(shù)不達(dá)標(biāo)哇,
不過(guò)盟劫,這并不能影響我夜牡,
畢竟人不裝逼跟咸魚(yú)有什么區(qū)別.
所以就寫(xiě)了一個(gè)裝逼的屏幕保護(hù)程序。
效果
下面步驟:
1.創(chuàng)建一個(gè) screensaver project
2.添加 GIF 圖片到項(xiàng)目 并顯示
3.添加到 系統(tǒng)偏好設(shè)置 - 桌面與屏幕保護(hù)程序中
創(chuàng)建1
創(chuàng)建2
//
// BugView.m
// Bug
//
// Created by Smile on 2019/9/20.
// Copyright ? 2019年 Mac. All rights reserved.
//
#import "BugView.h"
@interface BugView ()
@property (nonatomic, strong) NSImageView *fImageView;
@property (nonatomic, assign) CGFloat angle;
@end
@implementation BugView
- (instancetype)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
self = [super initWithFrame:frame isPreview:isPreview];
if (self) {
[self setAnimationTimeInterval:1/30.0];
NSBundle *bundle = [NSBundle bundleWithIdentifier:@"demo.Bug"];
NSLog(@"bundle.bundlePath: %@",bundle.bundlePath);
CGRect rect = self.bounds;
CGRect fRect = CGRectMake(0, 0, rect.size.width, rect.size.height);
NSString *fPath = [bundle pathForResource:@"x1" ofType:@"gif"];
NSImage *floatImage = [[NSImage alloc] initWithContentsOfFile:fPath];
_fImageView = [[NSImageView alloc] initWithFrame:fRect];
_fImageView.image = floatImage;
_fImageView.imageScaling = NSImageScaleProportionallyUpOrDown;
_fImageView.animates = YES;
_fImageView.canDrawSubviewsIntoLayer = YES;
[self addSubview:_fImageView];
}
return self;
}
- (void)startAnimation
{
[super startAnimation];
}
- (void)stopAnimation
{
[super stopAnimation];
}
- (void)drawRect:(NSRect)rect
{
[super drawRect:rect];
}
- (void)animateOneFrame
{
return;
}
- (BOOL)hasConfigureSheet
{
return NO;
}
- (NSWindow*)configureSheet
{
return nil;
}
@end
添加 gif圖片進(jìn)去侣签,然后編譯項(xiàng)目塘装。
編譯
找到屏幕保護(hù)程序
安裝到系統(tǒng)列表
然后就 ok 開(kāi)始裝逼急迂。
裝逼效果,嘿嘿