4
在iOS 7中運行良好的應用程序包含一個UIPopoverController,當用戶在其外部使用時,該應用程序將被解散。UIPopoverController不會在iOS 8/Xcode 6中失效
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中跳過我的popover!
任何想法?
UPDATE W/_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
'_myVC'的生命週期是什麼?它是否不止一次出現? – 2014-09-30 14:48:21
_myVC只創建一次,使用一個xib--其視圖出口在文件的所有者中設置。這是每次我推UIButton - 上面的代碼是運行 – DanMoore 2014-09-30 14:54:01
您可以顯示該代碼?我懷疑視圖控制器中的某些東西正在愚弄popover。 – 2014-09-30 15:00:15