1

好的,所以我最近(在过去的几个月内)开始玩 JB 调整开发,并且正在慢慢地将我在 git 上找到的开源拼凑在一起。但是,我遇到了一些程序员的障碍。我要做的是创建一个调整,当我从 SB 启动应用程序时,在它启动应用程序之前,alpha 浮点值动画为 0.0,持续时间为 1 秒。我遇到的问题是我一生都无法(而且我已经在互联网上搜索过,而且我确定它就在我面前,我只是出于某种原因没有看到它)找到有关如何获取的任何文档另一个 SB 头中的方法或属性被植入到另一个头的 %hook 中。

我需要从 SBIconView.h 中获取 -(id)_iconImageView 并在 SBApplicationIcon.h 的 -(void)launchFromLocation:(int)location 的 %hook 中使用它

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

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

这是我当前的代码

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
4

1 回答 1

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
于 2014-08-16T02:13:43.273 回答