使用MPMoviePlayerController
时,我想覆盖全屏按钮点按或隐藏它,以便我可以添加自定义按钮。
任务是真正改变MPMoviePlayerController
框架和其他子视图框架。
有什么想法吗?或者我必须使用不同的视频播放器才能实现这一目标?
答案 0 :(得分:0)
首先删除MPMoviePlayerController
的手势。然后添加自定义手势或按钮或其他控件。
self.player.view.gestureRecognizers = nil;
//Add your custom gestures or Button or other control
答案 1 :(得分:0)
我最近解决了类似的问题。我的客户坚持要禁用“上一页”和“下一页”按钮,但强烈建议我这样做,因为它非常棘手并且无法保证在下一个iOS版本中运行。所以我在这里发布我的解决方案作为一个非常不需要的选项)
-(void) disableNextPrevButtons:(UIView *) view :(int) level {
Class cl = NSClassFromString(@"MPKnockoutButton");
for (UIView * v in view.subviews) {
NSLog(@"[%d] scanning view of class %@ tag: %ld", level, NSStringFromClass(v.class), (long)v.tag);
if ([v isKindOfClass:cl]) {
for (UIView * v2 in v.subviews)
if ([v2 isKindOfClass:[UIImageView class]]) {
v.alpha = 0.0;
v.userInteractionEnabled = NO;
if (!buttonsDiscovered) {
buttonsDiscovered = YES;
UIButton * b = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, v.superview.frame.size.height, v.superview.frame.size.height)];
if (MLGSystemVersion() > 7.9)
b.alpha = 0.5;
b.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin);
[b setImage:[UIImage imageNamed:@"btnMPPause.png"] forState:UIControlStateNormal];
[b setImage:[UIImage imageNamed:@"btnMPPlay.png"] forState:UIControlStateSelected];
b.selected = YES;
[b addTarget:self action:@selector(btnPlayPauseDidPress:) forControlEvents:UIControlEventTouchUpInside];
b.center = CGPointMake(v.superview.frame.size.width / 2, v.center.y);
[v.superview addSubview:b];
self.btnPlayPause = b;
}
break;
}
} else
[self disableNextPrevButtons:v :level +1];
}
}
该方法是recursevely扫描并找到所需的控件并对它们做一些坏事