Code for the thing
let fileBrowser = UIDocumentPickerViewController(documentTypes: listOfAllTypesOfFiles, in: UIDocumentPickerMode.open)
fileBrowser.allowsMultipleSelection = false
fileBrowser.delegate = self
navigationController?.present(fileBrowser, animated: true, completion: nil)
Not sure why, but it shows that empty space at the bottom. Anyone knows what that is?
Found the issue. It was customizing tab bar via appearance. In particular that big chunk of view was some messed up version of shadow image which looks fine in main app, but not so much there. Don't customize your stuff like that people :)
It turns out that I had a global appearance() customisation causing issues with the document picker.
In my case this was the line causing the issue, removing it enabled the UIDocumentPickerViewController to display correctly.
UITabBar.appearance().isTranslucent = false
I've applied the appearance to my UITabBar directly instead of globally.
Alexander above (although downvoted) helped track the solution. Hope this helps whoever comes after.
Related
I've tried to refactor > rename an IBOutlet in xcode version 12.4 (12D4e), but the popup window seem to be not full displayed(like this attached). This thing made in quite not easy to see.
How to make the window full display like this, can anybody help me please, thank you so much.
You can change it to Full Screen from a storyboard like this:
or by programming:
self.modalPresentationStyle = .fullScreen
I am working on a macOS app where I want to give users the ability to switch between light and dark mode.
For iOS apps, this can be done by simply overriding the UserInterfaceStyle of UIWindow. Like so:
window.overrideUserInterfaceStyle = .dark //.light
The problem: NSWindow doesn't have a UserInterfaceStyle property.
I have tried to set the NSAppearance
window.appearance = NSAppearance(appearanceNamed: NSAppearance.Name.aqua, bundle: nil)
without success. It returns me an error saying: "RunTimeThemeRefForBundleIdentifierAndName() couldn't find NSAppearanceNameAqua.car in bundle with identifier: ..."
I am stuck. Do you have any ideas?
Here would be a solution for iOS
Thanks!
I was on the right track!
window.appearance = NSAppearance(named: .aqua)
worked.
There is actually a guide to set the appearance of macOS apps from apple.
Note: This also works if you have all your content inside a NSPopover, since it too has a property appearance.
How do I change the size and colour of the flashing cursor in my textfield using my storyboard for my Mac app.
I assume I have to connect it into the view controller script (control drag) and edit some uitextfield color parameter for the cursor?
But I don't seem to be getting anywhere fast. I am working in swift 2.2 with Mac app Storyboards. Like Ulysses and Taskpaper.
In Swift 3:
Change YOURTEXTFIELD to your textfield and you are set:
(YOURTEXTFIELD.value(forKey: "textInputTraits") as AnyObject).setValue(UIColor.black, forKey: "insertionPointColor")
Documentation: https://developer.apple.com/documentation/appkit/nstextview/1449309-insertionpointcolor
Search for _drawInsertionPointInRect that's the private method that you need. Though you also need some other stuff I think... but it's all mixed into my code so I can't say for sure what it all is. Anyway search for _drawInsertionPointInRect and you'll get to some explanations.
This is critical part of my run-time created menu:
GtkWidget *menu, *menu_item;
menu = gtk_menu_new();
menu_item = gtk_image_menu_item_new_with_label("Uredi...");
//approach1 - icon don't work
//gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU));
//approach2 - icon also don't work
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), GTK_WIDGET(gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU)));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
g_signal_connect(G_OBJECT(menu_item), "button-release-event", G_CALLBACK(menu_RELEASE), (gpointer)"");
gtk_menu_attach_to_widget(GTK_MENU(menu), button, NULL);
gtk_widget_show_all(menu);
Menu works OK but this is only one "imagemenuitem" on which I see label but don't see image.
What can be wrong here?
Gtk2, Ubuntu 11.10
I'm not 100% sure, but I believe icons in menus and buttons are no longer enabled by default. You need to turn them on to make them show up.
gconftool-2 --type bool --set /desktop/gnome/interface/menus_have_icons true
Or using dconf:
dconf write /org/gnome/desktop/interface/menus-have-icons true
Hey pretty old question so probably not much use. But I was having a very similar problem with a menu not showing images (in my case it was popup menu triggered by a button).
The way I solved it was calling the
gtk_image_menu_item_set_always_show_image(menu_item,TRUE);
This solved my problem, now my images always show :D woot :) As passing in 1 (true) means it will always show.
Ref:
http://developer.gnome.org/gtk3/3.0/GtkImageMenuItem.html
I'm using this code to bring up my window:
[self.window makeKeyAndOrderFront:self];
[self.window setOrderedIndex:0];
But often it will be beneath other windows or displayed in other Space desktop that I last open it in. How do I make it always appear "in front" to the user?
Update
I found the answer from previously asked question; make the window show up to the top of other windows:
[NSApp activateIgnoringOtherApps:YES];
But how to move the app to the user's current Space?
To bring your app to the front:
[NSApp activateIgnoringOtherApps:YES];
Swift:
NSApp.activateIgnoringOtherApps(true)
Swift 3:
NSApp.activate(ignoringOtherApps: true)
Perhaps you want:
[self.window setCollectionBehavior: NSWindowCollectionBehaviorCanJoinAllSpaces];
Experiment with the other collection behaviors... I found NSWindowCollectionBehaviorMoveToActiveSpace was a bit buggy in 10.5 but it might be better now.
Swift 5.0 +
NSWindow.orderFrontRegardless()
The syntax seems to be a little different with Swift 2:
NSApplication.sharedApplication().activateIgnoringOtherApps(true)
Swift 3.0
NSApp.activate(ignoringOtherApps: true)
But how to move the app to the user's current Space?
You don't. Spaces hold windows, not applications. (That's why the collectionBehavior property is on NSWindow, not NSApplication.)
If you want to your app to come to the front, even if its minimised and have it activated (given active focus), then use both of these:
NSApp.activate(ignoringOtherApps: true)
NSApp.windows.first?.orderFrontRegardless()
If you only want to bring it to the front, without giving it focus, just use:
NSApp.windows.first?.orderFrontRegardless()
Swift 2.0
NSApp.activateIgnoringOtherApps(true)
Helpful Programming Tips and Hacks