我在我的UI中播放视频进行装饰.我隐藏了AV播放器控件,但用户仍然可以控制视频.例如,他们可以使用滑动手势来快进或快退.
这对我来说特别令人惊讶,因为AVPlayerView在它上面有一个叠加视图.
有谁知道如何阻止所有用户与此视频互动?
我正在为Mail.app制作一个插件.我想要插件为Mail的工具栏添加一个按钮.为此,我决定最好的方法是调用函数在MessageViewer的initialize方法中添加此按钮(MessageViewer是Mail.app的FirstResponder的类).我正在修改的代码似乎工作得很好:
+ (void) initialize
{
[super initialize];
// class_setSuperclass([self class], NSClassFromString(@"MVMailBundle"));
// [ArchiveMailBundle registerBundle];
// Add a couple methods to the MessageViewer class.
Class MessageViewer = NSClassFromString(@"MessageViewer");
// swizzleSuccess should be NO if any of the following three calls fail
BOOL swizzleSuccess = YES;
swizzleSuccess &= [[self class] copyMethod:@selector(_specialValidateMenuItem:)
fromClass:[self class]
toClass:MessageViewer];
swizzleSuccess &= [[self class] copyMethod:@selector(unsubscribeSelectedMessages:)
fromClass:[self class]
toClass:MessageViewer];
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试做同样的事情时,它不起作用:
// //Copy the method to the original MessageViewer
swizzleSuccess &= [[self class] copyMethod:@selector(_specialInitMessageViewer:)
fromClass:[self class]
toClass:MessageViewer];
Run Code Online (Sandbox Code Playgroud)
以下是混合方法:
+ (BOOL)swizzleMethod:(SEL)origSel …Run Code Online (Sandbox Code Playgroud) 现在我有一个OS X故事板应用程序,它有一个主窗口,上面有一个按钮,触发另一个视图控制器的"show"segue.现在我已经将segue设置为模态,因为如果我不这样做,用户可以再次单击相同的按钮,最后得到同一窗口的两个副本.
有没有办法让我完成这个,而不必重新构建故事板,将这些视图控制器嵌入一个单独的窗口控制器中(这似乎会破坏故事板提供的灵活性的目的)?
我写了一个简单的测试,如下:
require 'spec_helper.rb'
describe Channel do
before(:each) do
@channel = Channel.new
end
it "should get the true view count" do
upload_view_count = double('upload view count')
upload_view_count.should_receive(:upload_num).and_return(16000666)
@channel.upload_view_counts << upload_view_count
@channel.save()
@channel.true_all_time_views.should equal(16000666)
end
it "should get the true view count with multiple upload view counts" do
upload_vc1 = double('uplaod view count 1')
upload_vc1.should_receive(:created_at).and_return(Time.now())
upload_vc1.should_receive(:upload_num).and_return(17666)
upload_vc1.should_receive(:updated_at).and_return(Time.now())
upload_vc2 = double('upload view count 2')
upload_vc2.should_receive(:created_at).and_return(Time.now())
upload_vc2.should_receive(:upload_num).and_return(17777)
upload_vc2.should_receive(:updated_at).and_return(Time.now())
@channel.upload_view_counts << upload_vc1
@channel.upload_view_counts << upload_vc2
@channel.save()
@channel.true_all_time_views.should equal(17777)
end
end
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此测试时,出现以下错误:
失败:
1)频道应该获得真实的视图计数失败/错误:upload_view_count = double('upload …