iOS 7 Jailbreak Tweak需要帮助将方法从一个标题拉到另一个标题的%钩子中

时间:2014-08-05 09:00:59

标签: objective-c jailbreak springboard

好的,所以我最近(在最近几个月内)开始使用JB tweak dev,并且正在慢慢地将我在git上找到的opensource组合在一起。但是,我打了一些编码器墙。我想要做的是创建一个调整,当我从SB启动应用程序时,在启动应用程序alpha浮点值动画为0.0,持续时间为1秒。我遇到的问题是我不能为我的生活(我已经在互联网上搜索过,而且我确信它在我面前我只是因为某些原因没有看到它)找到有关如何获取的任何文档另一个SB头中的方法或属性植入另一个头的%钩子中。

我需要从SBIconView.h中获取 - (id)_iconImageView并在%钩子中使用它 into - (void)launchFromLocation:来自SBApplicationIcon.h的位置(

我最初通过使用touchesEnded在SBIconView.h中部分工作,但是当动画完成其工作时,它会将图标投入抖动模式,因此我可以将所有应用程序都删除alpha值但不启动它们...所以我必须找到一种方法来利用 - (id)_iconImageView在SBApplicationIcon.h中获得我想要的结果。

非常感谢任何和所有的帮助或输入! 谢谢你的时间。

这是我目前的代码

enter code here

#import <AudioToolBox/AudioToolBox.h>


#define kBundlePath @"/Library/MobileSubstrate/DynmaicLibraries/com.cramage.LaunchNotifier"



@interface SBApplicationIcon
- (void)launchFromLocation:(int)arg;
@end

@interface SBIconView : UIView
-(id)_iconImageView;
-(float)iconImageAlpha;
+ (id)_jitterTransformAnimation;
+ (id)_jitterPositionAnimation;
+ (int)_defaultIconFormat;
@end


%hook SBApplicationIcon
-(void)launchFromLocation:(int)location
{

    SBIconView *sbic=[objc_getClass("SBIconView") _iconImageView];

    //NSString *message = [NSString stringWithFormat:@"%1.1f", [sbic iconImageAlpha]];
    //UIAlertView *alert2 = [[UIAlertView alloc]initWithTitle:@"Touch" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    //[alert2 show];
    //[alert2 release];

    //[NSThread sleepForTimeInterval:4.0];

    //%orig(location);

    NSURL *fileURL = [NSURL URLWithString:@"/System/Library/Audio/UISounds/play.caf"]; // see list below
    SystemSoundID soundID;
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)fileURL,&soundID);
    AudioServicesPlaySystemSound(soundID);



    //_iconImageView2.alpha = 1.0;




    UIView* iconImageView1 = [sbic _iconImageView];
    [UIView animateWithDuration:1.0 animations:^{

        iconImageView1.alpha = 0.0;


    }
    completion:^(BOOL finished){
       %orig(location);
    }];




}

%end

1 个答案:

答案 0 :(得分:0)

好的,所以我想出来了......

我最终要做的是将iconImageView1定义为%hook块之外的UIView并挂钩到touchEnded并将iconImageView1分配给_iconImageView。我可以在launchFromLocation的挂钩中调用它。

编码看起来像这样只是更清理了。我一直在努力学习其他东西,所以很多东西都被注释掉了,但实际上并不难以理解。

#import <AudioToolBox/AudioToolBox.h>
#import <CoreGraphics/CoreGraphics.h>


#define kBundlePath @"/Library/MobileSubstrate/DynmaicLibraries/com.cramage.LaunchNotifier"

@interface SBApplicationIcon
- (void)launchFromLocation:(int)arg;
@end

@interface SBLockViewOwner
//+(id)sharedInstance;
-(void)setShowingDeviceLock:(BOOL)lock;
@end

@interface SBIconView
-(id)_iconImageView;
-(void)touchesBegan:(id)began withEvent:(id)event;
-(void)touchesEnded:(id)ended withEvent:(id)event;
@end

//static UIView* iconImageView1;
//static BOOL isLaunching;

//%hook SBIconView

//-(void)touchesEnded:(id)ended withEvent:(id)event{
    //if (!isLaunching){
        //%orig;
    //}
//}

//-(void)touchesBegan:(id)began withEvent:(id)event{
    //if (!isLaunching){
        //iconImageView1 = [self _iconImageView];
        //%orig;
    //}
//}
//%end

%hook SBApplicationIcon


-(void)launchFromLocation:(int)location{
    //isLaunching = TRUE;

    SBLockViewOwner *sblvo = objc_getClass("SBLockViewOwner");

    //int state = TRUE;
    BOOL lock = TRUE;
    //sbdlc -(BOOL)_shouldLockDeviceNow = TRUE;
    [sblvo setShowingDeviceLock:(BOOL)lock];


    NSURL *fileURL = [NSURL URLWithString:@"/System/Library/Audio/UISounds/play.caf"]; // see list below
    SystemSoundID soundID;
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)fileURL,&soundID);
    AudioServicesPlaySystemSound(soundID);

    //CGSize newBounds = CGSizeMake(iconImageView1.frame.size.width/4,iconImageView1.frame.size.height/4);
    //iconImageView1.backgroundColor = [UIColor blueColor];

    //[sbdlc _setLockState:(int)state];

    //CGFloat direction = 1.0f;  // -1.0f to rotate other way
    //iconImageView1.transform = CGAffineTransformIdentity;
    //iconImageView1.transform1 = CGAffineTransformScale;
    //[UIView animateKeyframesWithDuration:5.0 delay:0.0
        //options:UIViewKeyframeAnimationOptionCalculationModePaced //| UIViewAnimationOptionCurveEaseInOut
        //animations:^{

            //[UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.0 animations:^{
                //iconImageView1.transform = CGAffineTransformMakeScale(5.25, 0.001);
            //}];
            //[UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.0 animations:^{
                //iconImageView1.transform = CGAffineTransformMakeRotation(180);
            //}];
            //[UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.0 animations:^{
                //iconImageView1.transform = CGAffineTransformMakeRotation(180);
            //}];
            //[UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.0 animations:^{
                //iconImageView1.transform = CGAffineTransformIdentity;
            //}];



        //}
        //completion:^(BOOL finished) {
            //isLaunching = FALSE;
            //%orig(location);
        //}];


}

%end