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
Related
I have NSTableView and a button in NSTableViewCell. I want to implement the functionality when the user clicks on my NSButton and cell goes to the renaming mode of its NSTextField.
I already set up action outlet for button and know when it's clicked but can't really find any info on how to trigger renaming. The answer might be pretty easy but I can't get to it. Thank you in advance!
P.S. I use Swift but any help would be great
Well, the answer is actually very easy, it's the lack of related information that makes it kinda hard.
So, in case anybody's looking for the same thing, that's how I implemented this feature(it's actually one-liner):
in your action outlet just call
cell.textField?.selectText(self)
and the text's gonna get selected. After that just keep implementing it as usual.
This is probably a lame question, but I don't know the answer (I have looked but found nothing). I created an iPad app that looks like this:
The red arrow is pointing to a UITabBarController, from which I connected segues to the other UIViewControllers. I also have a UINavigationController to the right, where I use segues to go between each of the modal scenes.
My question is: do I really need the segues that are attached to the UITabBarController? I have a need to programmatically go to one of the tab views from one of the modal scenes, but I can't seem to give an identity to any of the segues emanating from the UITabBarController, which makes me think they are useless/not used.
The answer is YES, they are needed. https://devforums.apple.com/message/930339#930339
I've got an NSPopover that is shown from interaction with an NSStatusItem. I've blogged about the hacks I needed to do to make input even possible in this situation here: http://blog.brokenrobotllc.com/using-nspopover-with-nsstatusitem
I have an NSTextField inside the NSPopover's content view. When I open the NSPopover, the NSTextField appears as if it is key (the cursor blinks). But, when typing, nothing shows up. If I click the mouse in the field, my input starts showing up there.
I've tried things like invoking NSWindow's makeFirstResponder upon popoverDidShow:. There was no change in behavior from this. Anyone have any ideas here?
My guess is you need to make your app active; try calling
[NSApp activateIgnoringOtherApps:YES];
when you show your popover.
Edit: Of course, I could be wrong. This is all just off the top of my head.
As what I said above. I encountered a problem that I have to dismiss the popover on screen while I don't know where it come from.
What I want to do is : when the app become inactive, I want to dismiss the popover. But I don't know where the popover is presented, and which controller is responds to it?
Is there a notification which I could listen to when the UIPopover is presented?
Or can I find the Popover on the screen?
Thank you guys.
Just subclass your own implementation of UIPopoverController and overridepresentPopoverFromRect:inView:permittedArrowDirections:animated and presentPopoverFromBarButtonItem:permittedArrowDirections:animated and keep track of popover references in a global array. Since Apple's HIG says only one popover is allowed at a time on screen, you only need to track the last one.
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.