贴点国外大神代码,没事瞅瞅

// 运行时,这整的

void SwizzleClassMethod(Class c,SEL orig,
SEL new)

{

    Method origMethod =class_getClassMethod(c, orig);

    Method newMethod =class_getClassMethod(c, new);

    

    c = object_getClass((id)c);

    

    if(class_addMethod(c, orig,method_getImplementation(newMethod),method_getTypeEncoding(newMethod)))

        class_replaceMethod(c, new,method_getImplementation(origMethod),method_getTypeEncoding(origMethod));

    else

        method_exchangeImplementations(origMethod, newMethod);

}

void SwizzleInstanceMethod(Class c,SEL orig,
SEL new)

{

    Method origMethod =nil, newMethod =
nil;

    

    origMethod = class_getInstanceMethod(c, orig);

    newMethod = class_getInstanceMethod(c, new);

    if ((origMethod !=nil) && (newMethod !=
nil))

    {

        if(class_addMethod(c, orig,method_getImplementation(newMethod),method_getTypeEncoding(newMethod)))

            class_replaceMethod(c, new,method_getImplementation(origMethod),method_getTypeEncoding(origMethod));

        else

            method_exchangeImplementations(origMethod, newMethod);

    }

    else

        NSLog(@"Attempt to swizzle nonexistent methods!");

}

void SwizzleInstanceMethodWithAnotherClass(Class c1,SEL orig, Class c2,
SEL new)

{

    Method origMethod =nil, newMethod =
nil;

    

    origMethod = class_getInstanceMethod(c1, orig);

    newMethod = class_getInstanceMethod(c2, new);

    if ((origMethod !=nil) && (newMethod !=
nil))

    {

        if(class_addMethod(c1, orig,method_getImplementation(newMethod),method_getTypeEncoding(newMethod)))

            class_replaceMethod(c1, new,method_getImplementation(origMethod),method_getTypeEncoding(origMethod));

        else

            method_exchangeImplementations(origMethod, newMethod);

    }

    else

        NSLog(@"Attempt to swizzle nonexistent methods!");

}

void InjectClassMethodFromAnotherClass(Class toClass, Class fromClass,SEL fromSelector,
SEL toSeletor)

{

    Method method =class_getClassMethod(fromClass, fromSelector);

    if (method !=nil)

    {

        if (!class_addMethod(toClass, toSeletor,method_getImplementation(method),method_getTypeEncoding(method)))

            NSLog(@"Attempt to add method failed");

    }

    else

        NSLog(@"Attempt to add nonexistent method");

}

void InjectInstanceMethodFromAnotherClass(Class toClass, Class fromClass,SEL fromSelector,
SEL toSeletor)

{

    Method method =class_getInstanceMethod(fromClass, fromSelector);

    if (method !=nil)

    {

        if (!class_addMethod(toClass, toSeletor,method_getImplementation(method),method_getTypeEncoding(method)))

            NSLog(@"Attempt to add method failed");

    }

    else

        NSLog(@"Attempt to add nonexistent method");

}

// 牛X 的方法,谁来弄弄

+ (void)setApplicationStatusBarAlpha:(float)alpha

{

    staticSEL selector =
NULL;

    if (selector ==NULL)

    {

        NSString *str1 =@"rs`str";

        NSString *str2 =@"A`qVhmcnv";

        

        selector = NSSelectorFromString([[NSStringalloc]
initWithFormat:@"%@%@",TGEncodeText(str1,
1),TGEncodeText(str2,
1)]);

    }

    

    if ([[UIApplicationsharedApplication]
respondsToSelector:selector])

    {

#pragma clang diagnostic push

#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

        UIWindow *window = [[UIApplicationsharedApplication]
performSelector:selector];

#pragma clang diagnostic pop

        

        window.alpha = alpha;

    }

}

static UIView *findStatusBarView()

{

    static Class viewClass =nil;

    staticSEL selector =
NULL;

    if (selector ==NULL)

    {

        NSString *str1 =@"rs`str";

        NSString *str2 =@"A`qVhmcnv";

        

        selector = NSSelectorFromString([[NSStringalloc]
initWithFormat:@"%@%@",TGEncodeText(str1,
1),TGEncodeText(str2,
1)]);

        

        viewClass = NSClassFromString(TGEncodeText(@"VJTubuvtCbs", -1));

    }

    

    if ([[UIApplicationsharedApplication]
respondsToSelector:selector])

    {

#pragma clang diagnostic push

#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

        UIWindow *window = [[UIApplicationsharedApplication]
performSelector:selector];

#pragma clang diagnostic pop

        

        for (UIView *subviewin window.subviews)

        {

            if ([subviewisKindOfClass:viewClass])

            {

                return subview;

            }

        }

    }

    

    returnnil;

}

//补充上面的方法

NSString *TGEncodeText(NSString *string,int key)

{

    NSMutableString *result = [[NSMutableStringalloc]
init];

    

    for (int i =0; i < (int)[stringlength];
i++)

    {

        unichar c = [stringcharacterAtIndex:i];

        c += key;

        [result appendString:[NSStringstringWithCharacters:&c
length:1]];

    }

    

    return result;

}

NSString *TGStringMD5(NSString *string)

{

    constchar *ptr = [string
UTF8String];

    unsignedchar md5Buffer[16];

    CC_MD5(ptr, (CC_LONG)[stringlengthOfBytesUsingEncoding:NSUTF8StringEncoding],
md5Buffer);

    NSString *output = [[NSStringalloc]
initWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", md5Buffer[0], md5Buffer[1],
md5Buffer[2], md5Buffer[3], md5Buffer[4], md5Buffer[5], md5Buffer[6],
md5Buffer[7], md5Buffer[8], md5Buffer[9], md5Buffer[10], md5Buffer[11],
md5Buffer[12], md5Buffer[13], md5Buffer[14], md5Buffer[15]];

    return output;

}

时间: 2024-07-31 09:23:12

贴点国外大神代码,没事瞅瞅的相关文章

class-烦请各位大神给小妹瞅瞅

问题描述 烦请各位大神给小妹瞅瞅 #include using namespace std; class xx { public: xx() { quantity=0; price=0; } void total(); static float average(); static void display(); private: int quantity; float price; static double discount; static float sum; static int n; }

c++-请教大神代码到底怎么写?

问题描述 请教大神代码到底怎么写? 我想要在C++中构造一个数组A[10],怎么写代码? int main(){ new AList A(10); for(int i=0;i<10;i++) cout<<A[i]<<endl;} 解决方案 type arrname[10]eg:int a[10] 解决方案二: int a[10]={0123456789}; 解决方案三: 可以用new关键字 int *a = new int[10]; 或者用c的方法 int a[10]={0}

国外大神已破解Sense 5.0,在HTC Butterfly蝴蝶机上运行

&http://www.aliyun.com/zixun/aggregation/37954.html">nbsp;   [科技讯]3月13日消息,在不久前HTC One发布会上,HTC表示Sense 5.0将会搭载在HTC One上首次面向公众,并在随后向其他机型推送Sense 5.0,不过HTC可能失算了.据悉,有国外大神已经破解了Sense 5.0,并成功在HTC Butterfly蝴蝶机上运行.     据了解,国外XDA论坛的大神newtoroot日前泄漏出了HTC On

国外大神的机器学习算法大汇总;如何用 50 行 PyTorch 代码实现 GANs | AI开发者头条

工具推荐:基于 LMDB 的机器学习张量数据快速读写工具 今天推荐一款基于 LMDB(Lightning Memory-Mapped Database)数据库的张量读写工具,专门为加快机器学习领域的数据读取速度而设计. 详情:https://github.com/vicolab/ml-pyxis 机器学习算法大汇总 近日有国外大神祭出了一张神图,图中针对机器学习领域几乎所有的常见算法进行了分类大汇总.不但简单介绍了每一种算法的大概含义,还整理了它们的常见应用和优缺点,各位开发者绝对不可错过. 原

PS利用蒙版将国外大神风景后期润色教程

  作者处理的非常细,画面中的每个细节都完美的体现出来,因此工作量也是非常大的,要不断用蒙版来控制调色范围,把局部的颜色及明暗度都刻画到位. 原图 最终效果 1.打开Raw后,先观察直方图,看哪里过曝哪里不足.在简单调节曝光.对比度.黑色/白色之后,又进行了智能锐化.他给出的数值是半径0.5,数量50,并尽可能保留细节. 2.接下来就是近似手绘的部分了,大量使用了蒙版.出于个人喜好,他减少了一些水流的蓝色让画面更暖. 3.接下来是饱和度,如图所示. 4.再为水流加个红色的蒙版,透明度11%,混合

国外大神风景后期润色教程

作者处理的非常细,画面中的每个细节都完美的体现出来,因此工作量也是非常大的,要不断用蒙版来控制调色范围,把局部的颜色及明暗度都刻画到位. 原图 最终效果 [1] [2] [3] [4] [5]  下一页

太腻害!国外大神在《Minecraft》中成功造出“硬盘”

class="post_content" itemprop="articleBody"> 我们已经听很多 Minecraft 玩家创造了令人难以置信的杰作,从梦幻又斑驳城堡到企业号航空母舰等等.不过,现在有些人真的把 Minecraft 玩到极致,比如这位化名"smellytring"的玩家在 Imgur 上解释他如何使用来自于 Minecraft 的材料和工具,创建一个1KB硬盘-- 相关阅读:千年帝都洛阳 – 炫!国人玩家打造<我

拳皇 2001 真人版 - 国外大神神级COS,全程高能,笑翻了!

class="post_content" itemprop="articleBody"> 还记得拳皇98.99的真人版么?最近,老外又来恶搞了,这次貌似有增加了不少新的特效,做的非常用心的说,笑点也非常多.看来如今他们越来越受欢迎了,不知还会不会有更多作品发布呢-- 拳皇 2001 真人版

对象-java JDBC 批量插入的时候报数组下标越界,求大神

问题描述 java JDBC 批量插入的时候报数组下标越界,求大神 代码:private static Boolean Function_User(Map resultMap String sqlString tableType) { // TODO Auto-generated method stub Connection conn=null; PreparedStatement insert_st=null; int count = 0; final int batchSize = 500;