我的一个在 iOS 7 中运行良好的应用程序包含一个 UIPopoverController,当用户点击它的外部时,它会被关闭。
UIPopoverController *myPopover = [[UIPopoverController alloc] initWithContentViewController:_myVC];
myPopover.popoverContentSize = CGSizeMake(300.0, 600.0);
[myPopover presentPopoverFromRect:sender.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
当我在 iOS 8 中运行我的应用程序时,没有崩溃,但是当我尝试通过点击外部退出弹出窗口时,出现一条错误消息:
attempt to dismiss modal view controller whose view does not currently appear.
控制台还告诉我:modalViewController = _myVC ...
我无法在 iOS 8 中退出我的弹出窗口!!
有什么想法吗?
使用 _myVC 代码进行更新:
@protocol MyVCDelegate <NSObject>
@optional
- (void)myVCDoneProc:(NSURL *)sender;
- (void)calculateFileLengthConvolve;
- (void)checkConvolveTime;
@end
@interface MyVC: UIViewController <FirstDelegate, SecondDelegate>
{
UIImageView *mDimView;
UIActivityIndicatorView *mSpinner;
IBOutlet UISlider *mMixSlider;
IBOutlet UILabel *mTimeWarningLabel;
IBOutlet UIButton *mButton;
}
@property (nonatomic, weak) AudioFilesViewController *AFVC;
@property (nonatomic, strong) IBOutlet UIView *view;
@property (nonatomic, assign) id<UnivConvolutionViewControllerDelegate>delegate;
@property NSString *filePath;
- (void)calculateFileLength;
- (IBAction)process;
- (IBAction)play:(UIButton *)sender;
- (IBAction)stop:(UIButton *)sender;
- (void)checkConvolveTime;
@end
@interface myVC () <UITableViewDelegate, UITableViewDataSource>
@end
@implementation myVC
{
IBOutlet UITableView *mImpulsesTableView;
NSArray *mImpulses;
NSString *irPath;
NSArray *userImpulses;
}
@synthesize AFVC = _AFVC;
@synthesize view;
@synthesize delegate;
@synthesize filePath = mFilePath;
- (void)init {
if(self = [super init]) {
[[NSBundle mainBundle] loadNibNamed:@"MyVC" owner:self options:nil];
// create mImpulses
// set button titles and font, other init... etc.
}
}
#pragma mark behavior - class methods
// The only view code is in:
- (void)process {
if (mDimView == nil) {
mDimView = [[UIImageView alloc] initWithImage:[DimmingImage dimmingImageWithSize:self.view.bounds.size]];
mDimView.userInteractionEnabled = YES;
mSpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
mSpinner.hidesWhenStopped = YES;
[mDimView addSubview:mSpinner];
mSpinner.center = CGPointMake(mDimView.bounds.size.width/2.0f,
mDimView.bounds.size.height/2.0f);
}
mDimView.alpha = 0.0f;
[self.view addSubview:mDimView];
[UIView animateWithDuration:0.35f animations:^{
mDimView.alpha = 0.7f;
} completion:^(BOOL finished) {
[mSpinner startAnimating];
}];
}
#pragma mark FirstDelegate & Second Delegate
// FirstDelegate method to remove subviews when processing is complete
- (void)hideActivityView
{
dispatch_async(dispatch_get_main_queue(), ^{
[mSpinner stopAnimating];
[UIView animateWithDuration:0.35f animations:^{
mDimView.alpha = 0.0f;
} completion:^(BOOL finished) {
[mDimView removeFromSuperview];
}];
});
}
#pragma mark UITableViewDelegate & DataSource
#pragma mark
@end
最佳答案
我在模态展示方面遇到了一些问题。我犯的错误是在 viewDidLoad 中以模态方式呈现它。您可以尝试在 viewDidAppear 中呈现它。这解决了我的问题。
关于ios - UIPopoverController 在 iOS 8/Xcode 6 中没有关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26123625/
我好像记得Lua有类似Ruby的method_missing的东西。还是我记错了? 最佳答案 表的metatable的__index和__newindex可以用于与Ruby的method_missing相同的效果。 关于ruby-难道Lua没有和Ruby的method_missing相媲美的东西吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/7732154/
我有一个奇怪的问题:我在rvm上安装了rubyonrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(
我想在一个没有Sass引擎的类中使用Sass颜色函数。我已经在项目中使用了sassgem,所以我认为搭载会像以下一样简单:classRectangleincludeSass::Script::FunctionsdefcolorSass::Script::Color.new([0x82,0x39,0x06])enddefrender#hamlengineexecutedwithcontextofself#sothatwithintemlateicouldcall#%stop{offset:'0%',stop:{color:lighten(color)}}endend更新:参见上面的#re
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121
这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下
我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的
大家好!我想知道Ruby中未使用语法ClassName.method_name调用的方法是如何工作的。我头脑中的一些是puts、print、gets、chomp。可以在不使用点运算符的情况下调用这些方法。为什么是这样?他们来自哪里?我怎样才能看到这些方法的完整列表? 最佳答案 Kernel中的所有方法都可用于Object类的所有对象或从Object派生的任何类。您可以使用Kernel.instance_methods列出它们。 关于没有类的Ruby方法?,我们在StackOverflow
下面的代码在我第一次运行它时就可以正常工作:require'rubygems'require'spreadsheet'book=Spreadsheet.open'/Users/me/myruby/Mywks.xls'sheet=book.worksheet0row=sheet.row(1)putsrow[1]book.write'/Users/me/myruby/Mywks.xls'当我再次运行它时,我会收到更多消息,例如:/Library/Ruby/Gems/1.8/gems/spreadsheet-0.6.5.9/lib/spreadsheet/excel/reader.rb:11
我真的为这个而疯狂。我一直在搜索答案并尝试我找到的所有内容,包括相关问题和stackoverflow上的答案,但仍然无法正常工作。我正在使用嵌套资源,但无法使表单正常工作。我总是遇到错误,例如没有路线匹配[PUT]"/galleries/1/photos"表格在这里:/galleries/1/photos/1/edit路线.rbresources:galleriesdoresources:photosendresources:galleriesresources:photos照片Controller.rbdefnew@gallery=Gallery.find(params[:galle
我在Rails应用程序中使用CarrierWave/Fog将视频上传到AmazonS3。有没有办法判断上传的进度,让我可以显示上传进度如何? 最佳答案 CarrierWave和Fog本身没有这种功能;你需要一个前端uploader来显示进度。当我不得不解决这个问题时,我使用了jQueryfileupload因为我的堆栈中已经有jQuery。甚至还有apostonCarrierWaveintegration因此您只需按照那里的说明操作即可获得适用于您的应用的进度条。 关于ruby-on-r