Custom Keyboard Apps (IQKeyboardManager & SwiftKey) - swift

I have a user who has this problem in their IphoneX iOS 13.2, he has no "done" button to accept a comment because seems like he is using SwiftKey app for custom keyboards and in my testing IQKeyboardManager is doing good.
So SwiftKey app has a problem with IQKeyboardManager, the done button of the toolbar is not showing up and either the "dark theme" on the keyboard.
Any suggestions?

You can double check this on that instance.
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.enableAutoToolbar = true
IQKeyboardManager.shared.overrideKeyboardAppearance = true
IQKeyboardManager.shared.keyboardAppearance = .dark

Related

Swift macOS | Setting (switching between) dark and lightmode

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.

Old issue back on iOS 14: Can't set text color of Cancel button in mail composer presented from UIActivityViewController

This is a known issue I have faced before but my previous solution is not working on iOS 14, so the white cancel button is invisible against a white background. I have tried alternatives that worked for previous versions, but none work on iOS 14.
This is what used to work and doesn't anymore:
UIBarButtonItem.appearance().setTitleTextAttributes([.foregroundColor: .black], for: .normal)

Change backgroundImage of right Nav button in Titanium - iPhone

I am developing an iPhone app using Titanium Alloy.
My problem is that I would like to change the backgroundImage of rightNav button.
I am using the rightNav button as a Filter button. My Filter button is placed in a window which also has a table. Once the filter button is clicked a new window is opened where the user can make some selections. Once the selection is made, the table on the previous page is refreshed based on the selections made and I would like to change the backgroundImage of the rightNav button to show that some selections have been applied. But I am unable to do so.
My code :
if ((screenType === "parentWindow") {
$.rightNav.visible = true;
$.rightNav.backgroundImage = "/images/buttons/filterOff.png";
} else if ((screenType === "childWindow")) {
$.rightNav.visible = true;
$.rightNav.backgroundImage = "/images/buttons/filterOn.png";
}
The backgroundImage of the rightNav button is set first time and then it is not changed. I have tried to make it null and then set it again but it does not work.
Please help.
Other details :
Titanium Command-Line Interface, CLI version 4.0.0, Titanium SDK version 4.0.0.RC, Mac OS X 10.10
Thanks
Try using the image property .

Hide password with "•••••••" in a textField

In my app there is a textField where the user have to put is password in and i want that when he enter a character it change it to '•' how can i do this?
You can achieve this directly in Xcode:
The very last checkbox, make sure secure is checked .
Or you can do it using code:
Identifies whether the text object should hide the text being entered.
Declaration
optional var secureTextEntry: Bool { get set }
Discussion
This property is set to false by default. Setting this property to true creates a password-style text object, which hides the text being entered.
example:
texfield.secureTextEntry = true
in Swift 3.0 or Later
passwordTextField.isSecureTextEntry = true
Swift 4 and Xcode Version 9+
Can be set via "Secure Text Entry" via Interface Builder
In Xcode 6.3.1, if you use a NSTextField you will not see the checkbox for secure.
Instead of using NSTextField use NSSecureTextField
https://developer.apple.com/documentation/appkit/nssecuretextfield
I'm guessing this is a Swift/Objective-C change since there is now a class for secure text fields. In the above link it says Available in OS X v10.0 and later. If you know more about when/why/what versions of Swift/Objective-C, Xcode, or OS X this
For SwiftUI, try
TextField ("Email", text: $email)
.textFieldStyle(RoundedBorderTextFieldStyle()).padding()
SecureField ("Password", text: $password)
.textFieldStyle(RoundedBorderTextFieldStyle()).padding()
Programmatically (Swift 4 & 5)
self.passwordTextField.isSecureTextEntry = true
You can do this by using properties of textfield from Attribute inspector
Tap on Your Textfield from storyboard and go to Attribute inspector , and just check the checkbox of "Secure Text Entry" SS is added for graphical overview to achieve same

Xcode & Swift - Window without title bar but with close, minimize and resize buttons

I am currently using Swift in Xcode 6, Beta 5.
I am trying to remove the title bar, or any visible difference between the title bar and the actual content. If I enable "Unified title and toolbar" in the Attributes Inspector on a Window, nothing visibly happens. I have already left the title out.
When no title is entered, the title bar will still be distinguishable because of the border line and background difference with the rest of the window, separating it from the actual content.
An excellent example would be the current Yosemite, OS X 10.10, Notes app. No title bar is visible or distinguishable, just the Close, Minimise and Resize buttons as seen here.
I have searched and visited other posts, but to no to little avail.
Those mentioned hiding the title bar altogether, but I wouldn't know how to manually re-add the Close, Minimise and Resize buttons properly, meaning they would look correct, no actual, sneaky image replacements and connections with the menu bar Close, Minimise and Resize functions.
The new window style mask NSFullSizeContentViewWindowMask added in OS X 10.10 will do the trick.
self.window.titleVisibility = NSWindowTitleVisibility.Hidden;
self.window.titlebarAppearsTransparent = YES;
self.window.styleMask |= NSFullSizeContentViewWindowMask;
Release Notes
Since MacOS X 10.10, you can use these:
if #available(macOS 10.10, *) {
window.titlebarAppearsTransparent = true
}
if #available(macOS 10.2, *) {
window.movableByWindowBackground = true
}
There was an official sample project for window appearance in Yosemite. You might wanna check it out.
For Swift 3 :-
self.window.titleVisibility = .hidden
self.window.titlebarAppearsTransparent = true
self.window.styleMask.insert(.fullSizeContentView)
If you are using storyboard, it's just a simple check box in the Inspector bar.
Select the window from Story Board
Check the Transparent Title Bar checkbox in the inspector window.
Here's how it looks like in the Story board. It looks the same when you build and run the application.
You can use these:
override func viewDidAppear() {
super.viewDidAppear()
self.view.window?.titlebarAppearsTransparent = true
self.view.window?.movableByWindowBackground = true
}
Update Sept. 2017, taget 10.11:
override func viewDidAppear() {
super.viewDidAppear()
self.view.window?.titleVisibility = .hidden
self.view.window?.titlebarAppearsTransparent = true
self.view.window?.styleMask.insert(.fullSizeContentView)
}
I don't have enough reputation to comment on Ranfei Songs answer, but running on OSX 10.12 the syntax for the titleVisibility is slightly different, instead of this:
self.window.titleVisibility = NSWindowTitleVisibility.Hidden;
you'll need to use NSWindowTitleHidden instead, so updating Ranfei's code would result in you need to specify this like this:
self.window.titleVisibility = NSWindowTitleHidden;
self.window.titlebarAppearsTransparent = YES;
self.window.styleMask |= NSFullSizeContentViewWindowMask;