iOS 7: keyboard shows in UIKeyboardAppearanceLight when an app is opening from multitasking screen - ios

I've noticed an issue with the keyboard in ios 7, and I'm not sure if I'm doing something wrong.
Here's a simple scenario which replicates the issue on a blank xcode 5 project:
When you tap on a textfield added using interface builder (with keyboard appearance set to dark), the correct (dark) keyboard appears.
If you then resign the responder (add a button or something for that) > press the home button to get to home screen > double press the homebutton to get to the multitasking selection screen > tap on the app > tap on the textfield > it shows up the Light keyboard for a second, and then it draws the dark keyboard.
So is this an iOS bug or could it be something on my end?

Related

Cannot type in emulator search bar

When I use an iOS device for debugging, I can type and retype into the search bar at the top (I am running a webkit browser inside my app). If I do this in the emulator I can type in it when the search bar is empty but after I have search for something and it is filled with a URL, I cannot retype into it as the search bar moves back and forth when I try to select it.
It works perfectly fine on an actual iOS device but on the emulator it will toggle.
It uses the basic webkit library: https://en.wikipedia.org/wiki/WebKit
I expect it to work like on the iOS device and it does if I toggle the software keyboard but without it, it doesn't.
From the engineer who fixed it:
It's actually strange. I'm not sure if this PR is relying on an undocumented behaviour, but it should be safe even if that changes. Here's what's happening.
iOS should fire UIResponder.keyboardWillShowNotification when the keyboard is going to be displayed, and UIResponder.keyboardWillHideNotification when the keyboard is going to be hidden. For both notifications, this code retrieves the frame of the keyboard:
let beginRect = (notification.userInfo?[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue
let endRect = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
What's strange is that in the iOS simulator, if the software keyboard is toggled off (so simulating an external keyboard), UIResponder.keyboardWillShowNotification is never fired (which is understandable) and UIResponder.keyboardWillHideNotification is fired both when a text box becomes first responder (i.e. gains focus) and when the textbox resigns first responder (i.e. loses focus). I guess the rationale is that these notifications are fired for the software keyboard and in both cases the keyboard is hidden. Empirically, in iOS 12 (and iPhone X):
A. When a text box becomes first responder, beginRect.size.height=0 and endRect.size.height ~54. Both origin.y remains at ~812 (out of the screen).
B. When a text box resigns first responder, beginRect.size.height ~54 and endRect.size.height=0. Both origin.y remains at ~812 (out of the screen).
The fix is to test for A and ignore it when handling UIResponder.keyboardWillHideNotification

Swift: Touch not immediately registered for UIButtons located at bottom of UIViewController

I run into a strange behaviour I am not able to solve. If I place a UIButton at the bottom of the UIViewController of the Main Storyboard, touching it is not immediately registered. It takes about 0.5 seconds till the touch gets registered. You can see than from standard UIButtons when they change the text color. I don't have this issue with buttons anywhere else in the UIViewController.
All I did is adding a Vertical Stack View with 15 UIButtons to the Main View Controller of a new App. When I execute the App on an iPhone 6 or iPhone 8 (the actual devices), the lowest button behaves differently. Touching it doesn't change the text color immediately, while it does for all the other buttons.
Did anyone experience the same issue? Is there a way to solve this or did I just find a bug in the framework? I'm using Xcode 9.2 and deployment target is iOS 11.2.
Go to AppDelegate and try adding:
for gesture in self.window.gestureRecognizers {
gesture.delaysTouchesBegan = NO;
}
It will stop the system from checking to see if you are trying to open control centre.

Swipe iphone home screen to left , XCode UI Testing

Following is my piece of code . After the launch of application I click on the submit button which shows me an alert.
After I click ok on the UIAlertViewController I move to the home screen , and then I want to swipe left on the home screen.
Any idea how this can be done.
Any help will be appreciated
func testExample() {
let app = XCUIApplication()
app.buttons["Submit"].tap()
app.alerts["Please enable bluetooth"].buttons["OK"].tap()
XCUIDevice.sharedDevice().pressButton(XCUIDeviceButton.Home)
}
As of Xcode 8.0 you cannot interact with the UI outside of your application from the UI Test target. I filed a bug report http://www.openradar.me/radar?id=6180999608139776

How to hide KeyBoard in ios9 (Ipad)

I edit text in textField,and add UIKeyboardWillHideNotification to notification centre.
Click the keyboard icon which is in the bottom-right corner in the keyboard to hide the keyboard。
But I find the Shortcuts Bar(paste/undo ) still exist,and i do not get the notification(UIKeyboardWillHideNotification).
It works ok on ios8.
-->Click the keyboard icon
]
When click the keyboard icon in the keyboard, it will trigger the UIKeyboardWillHideNotification in ios8, then i resignFirstResponder for textField and make the textfield lost cursor.But it can not trigger the UIKeyboardWillHideNotification in ios9. So i think it causes by the keyboard is not hidden completely(the tools bar) when click the keyboard icon in ios9. i want to know how to hide the keyboard completely in ios9 when click the keyboard icon. or any other solution to resign the first response for the textfield when click the keyboard icon.
Thanks
Try this library it will manage automaticall keyboard hide and show.
Paste this line in didFnishLaunchingWithOption method in AppDelegate
IQKeyboardManager.sharedManager().enable = true
KeyboardManager
"it is showing only in simulator if you try on device it will hide shortcuts also hide on device." – johny kumar

Cancel button from UIActionSheet doesn't appear after long press on phone number in UITextView

I have a problem with the devices that have less then 4 inch display. When pressing long tap on phone number in UITextView, the UIActionSheet that appears doesn't show the Cancel button. The issue is that the actionSheet does showInView, instead of showFromTabBar.
In a demo app, this issue doesn't reproduce. Need help!
Check that the option 'Full Screen at Launch' is checked on the Window in you MainWindow.xib.
I had a similar problem and others when updating for iPhone 5 screen. Apparently the 'Simulated metrics' of Window will be the actual metrics when launching (provided you have not checked 'Full Screen at Launch').
Apple actually has a Note about it in the UIWindow Class Reference:
... If you choose to create a window in Interface Builder, be sure to select the Full Screen at Launch option in the Attributes inspector so that the window is sized appropriately for the current device. ...

Resources