【问题标题】:How to %hook to add UIButton to YouTube from App Store如何 %hook 以将 UIButton 从 App Store 添加到 YouTube
【发布时间】:2014-08-07 07:57:21
【问题描述】:

我正在使用 theos,并且我能够 %hook 整个 YouTube 的功能,但我无法弄清楚如何将 UIButton 添加到 YTMainVideoPlayerOverlayView 类的视图中

这是我正在学习的课程。

YTMainVideoPlayerOverlayView.h

我正在考虑使用这些方法中的任何一种

- (void)setVideoButtonsForLayout:(int)arg1;
- (void)setPlayerViewLayout:(int)arg1;
- (void)layoutSubviews;
- (id)init;

我也发现了这个,可能是在使用CGRectMake

- (float)topButtonsXOffset;

任何人都可以给我一个提示或示例,(请)关于如何 %hook 并能够添加UIButton 与代表请。

【问题讨论】:

    标签: ios youtube jailbreak theos cydia-substrate


    【解决方案1】:

    试试这个:

     @interface THE_CLASS_YOU_WANT_TO_HOOK : UIView  //or UIViewController if the class you're hooking is a view controller
     -(void)yourMethod:(UIButton *)button;
     @end    
    
    
    %hook THE_CLASS_YOU_WANT_TO_HOOK
    
    -(void)layoutSubviews //or loadView if you're hooking a view controller{
       %orig;
       UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
       [button setTitle:@"YOUR_BUTTON_TITLE" forState:UIControlStateNormal];
       button.frame = CGRectMake(x,y,hight,width);
        [button addTarget:self action:@selector(yourMethod:) forControlEvents:UIControlEventTouchUpInside];
      [self addSubview:button]; //if you're hooking a view controller use self.view
    
    }
    %new;
    -(void)yourMethod:(UIButton *)button {
    
    // Do whatever you want when you press the button here.
    }
    %end
    

    【讨论】:

      猜你喜欢
      • 2017-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多