I'm working on a "Mac OSX App" that has two view controllers, the app starts from the first view (bottom view) and later "Canvas view controller (top view)" is presented from the first view controller.
After presenting "CanvasViewController (top view)",
CanvasView appears correctly with its buttons on the top of bottom view however the border line of the button of the bottom view still appears. I have attached the images of the bottom and top views below.
It doesn't look like alpha value issue as it is set to 1.0, instead it is related to some things else in the viewController settings (ie. first responder or button state, etc).
How can I remove this bottom view's button border line when the top view is presented on the top?
Any solutions or helpful comments will be much appreciated. Thanks in advance.
// From bottom view's viewController
@interface MainMenuViewController : NSViewController
@end
@implementation MainMenuViewController
...
-(IBAction)presentNextViewWithAnimator:(id)sender{
id animator = [[MyCustomAnimator alloc] init];
CanvasViewController* viewController = [[CanvasViewController alloc] initWithNibName:@"CanvasViewController" bundle:nil];
// presenting "topView" with custom animator
[self presentViewController:viewController animator:animator];
}
...
@end
// From "top view's viewController"
@interface CanvasViewController : NSViewController
@end
@implementation CanvasViewController
...
// "close" button
-(IBAction)closeCanvas:(id)sender{
[self dismissViewController:self];
}
// "refresh" button
-(IBAction)refreshCanvas:(id)sender{
}
...
@end
// From the view presentation's custom animator
@interface MyCustomAnimator : NSObject <NSViewControllerPresentationAnimator>
@end
@implementation MyCustomAnimator
-(void) animatePresentationOfViewController:(NSViewController *)viewController
fromViewController:(NSViewController *)fromViewController
{
NSViewController* bottomVC = fromViewController;
NSViewController* topVC = viewController;
topVC.view.wantsLayer = YES;
topVC.view.layerContentsRedrawPolicy = NSViewLayerContentsRedrawOnSetNeedsDisplay;
topVC.view.alphaValue = 1.0f;
[bottomVC.view addSubview:topVC.view];
CGRect frame = NSRectToCGRect(bottomVC.view.frame);
[topVC.view setFrame:NSRectFromCGRect(frame)];
topVC.view.layer.backgroundColor = [NSColor whiteColor].CGColor;
[NSAnimationContext
runAnimationGroup:^(NSAnimationContext * context){
context.duration = 0.5f;
topVC.view.animator.alphaValue = 1.0f;
} completionHandler:nil];
}
...
@end

