How to display NSPanel in front of Fullscreen-View? - objective-c

My application rund modally in fullscreen, and I need something like iOS' UIPopoverController. The first idea was using an NSPanel, but I can't get it to show in front of the fullscreen view.
I need either a UIPopoverController-like class for Cocoa or a way to display a NSPanel in front of a fullscreen view. How can I accomplish this?

Sorry, none of them really worked.
The solution was:
[yourPanel setLevel:kCGMaximumWindowLevel];
However, Wevah and SphereCat1 helped me find the setLevel: method. Thanks.

Try this instead:
[yourPanel setLevel:NSMainMenuWindowLevel+1];
That should put it above everything on the screen. Happy Coding!
Billy

Something like
[yourPanel setLevel:[fullscreenWindow level] + 1];
should work.

Related

Button does not react

I have a strange behaviour with an NSButton. It works normal until I do so voodoo somewhere else in my app. Right then the button does no longer react on click events. It still looks normal (so not disabled). It just does not do anything when I click it. Any idea where I should look in the properties of NSButton that might have been changed accidentally? (Quite sure I did not touch the button itself.)
Ensure your button is in a 'touchable' zone in its superView. I mean It have ro be placed inside it superView bounds (If not, you can see It, depending on Clipping properties, and you can't interact with It). In order to check it, set a color to your container view.
Also check userInteraction is enabled...
Hope It helps.
If your button is just not giving the animation, it might be an Xcode bug. I had a similar problem before, and I filed a bug, and it got fixed on the next Xcode version. Check out my SO question. Toolbar bar button item not working properly in SplitViewController
If you really need to give it an animation, you could probably do it in code with something like this. Please note that this is untested so it may not work, or you might need some fixing, but you get the idea :)
- (IBAction)buttonAction:(id)sender {
self.button.titleLabel.textColor = [UIColor lightGrayColor];
// Action
self.button.titleLabel.textColor = [UIColor darkTextColor];
// Or with delay
[self performSelector:#selector(changeButtonColor) withObject:nil afterDelay:0.1];
}
I figured it out. The button opened a transient popover. In order to close this popover due to an action I had coded
view.window!.orderOut(self)
After replacing it by
view.window!.performClose(self)
the strange effect was gone. I'm not sure, but this looks like a bug in the Swift runtime. I'll report it and see what comes out.

TableView looks strange in Simulator & on iPhone

I'm working on a little private helper app on keeping track of refueling my car and stuff..
Everything just worked fine until I started the simulator...
Here's how the TableView looks in the StoryBoard:
http://i.imgur.com/Ov7F1CW.png
And here's how it looks on the iPhone or Simulator:
http://i.imgur.com/Cq1yUkK.png
I already tried fixed, freeform and inferred sizes for the ViewControllers-
no success..
How can this be?
What causes this?
Think there's a quite long story to get there but I would try to answer the very question you asked.
You have probably composed your storyboard table view scene with a 'Dynamic Prototypes' content and then all the cells we can see in the storyboard are just namely prototypes, which can be used in runtime programmatically.
In order to make a scene in a wysiwyg manner, you should choose 'Static Cells' option instead.
Here's the answer. I was using "Size Classes" on my very first Navigation Controller.
Don't ask me why all my other Tabled didn't get messed up, but this was the solution for me.
Thanks for Your help! :)

Alternative to UIALertView for user input ios7

Ok, we assume that now we can't add subviews in AlertViews since ios7. But when we need to popup a new little view for the user to input some data, what we have to do ? What apple says we have to do now ?
You can create your own custom alert.
I explain here a way how to do that.

UIPopoverController Duplicates

I have a popover view in my app which is opened by a UIBarButtonItem, however if I continue to tap that button, it will just create more and more popovers, but I only want one of course, not loads of duplicates!
How can I handle this?
Thanks.
Keep a reference to the UIPopoverController you have on the screen (you can do this by having an ivar). When you click the button, check it exists, if yes, then close it and release it.
Josh,
unfortunately, this is not an answer, only a reference to the same question I posted.
UIPopoverController not dismissed when opened from self.navigationItem (inside UINavigationController)
Hoping to get answers for all of them in this manner.
If someone can tell me how to attach comments to questions - that's the better place for hints like this, I guess.
Regards, nobi

May I add a second subview to window if rootViewController is a UISplitViewController to simulate a modal effect?

I'm currently using UISplitViewController as my app's rootViewController. To present progress dialogs I use presentModalViewController, but for the one and other reason I'm not entirely happy with it and want to do my own modal thing.
If one of my modal views is supposed to be shown, I want to add another subview to my app's main window. This subview is going to be managed by its own UIViewController subclass to make it rotate properly and do all the stuff I need.
Is this design aproach okay or will I run into issues with UISplitViewController (it is very special in so many ways and seems to be offended easily if not treaten right! :-))?
Is it a problem to have two UIViewControllers next to each other?
Please don't discuss "why don't you use presentModalViewController then?".
You may be ok with UISplitViewController if you do it properly, as presentModalViewController does something similar.
One alternative you should look into is UIPopoverController and the UIViewController's modalIfPopover property.
Also, you say you aren't happy with presentModalViewController and perhaps if you say what was wrong with it we can help you work around whatever issues you have with it. This is the exact case that it seems to be meant for.