如何%钩从App Store将UIButton添加到YouTube

时间:2014-08-07 07:57:22

标签: ios youtube jailbreak theos cydia-substrate

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

这是我要上课的课程。

YTMainVideoPlayerOverlayView.h

我正想着挂钩任何这些方法

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

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

- (float)topButtonsXOffset;

任何人都可以给我一个提示或示例(请)关于如何挂钩并且能够与代表一起添加UIButton

1 个答案:

答案 0 :(得分:0)

试试这个:

 @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