display soft keyboard (iPad) when is connected a bluetooth input device - iphone

I'm really bangin' my head because I can't find the way to show the soft keyboard when there's a bluetooth input device connected to the iPad. I made some search on the web and this is the result:
a question on stackoverflow with a very short answer How can I detect if an external keyboard is present on an iPad?
an application developed by erica sadun for the cydia env http://www.tuaw.com/2010/06/02/hacksugar-bringing-back-the-on-screen-keyboard/
Erica said that the trick is to answer to the system that "There's no hardware keyboard attached".
I tried to write a category for UIKeyboardImpl and I overrided:
- (BOOL)isInHardwareKeyboardMode {
DEBUG(#"is called");
return NO;
}
But until now I haven't obtained anything. The overrided method is called but there's no soft keyboard.
Erica also said the application works by dynamic linking but I don't know how can I accomplish it. I don't need to be in the AppStore because this is a private application so I don't bother about rejection.
Thanks in advance

Ok. Finally got it. Many thanks to David, Matthias and Enrico. Here are the steps:
import the private framework GraphicsServices
call GSEventSetHardwareKeyboardAttached(NO) inside the viewDidLoad
add a button that toggles the keyboard by calling
static void toggleKeyboard(UIKeyboardImpl * keyImpl){
if (UIKeyboardAutomaticIsOnScreen()) {
UIKeyboardOrderOutAutomatic();
} else {
UIKeyboardOrderInAutomatic();
}
I've found this function on http://code.google.com/p/btstack/wiki/iPhoneKeyboardHiding
Now I can take input from the soft keyboard and from the bluetooth device at the same time.

To get around it using the apple keyboard you hit the eject key. Perhaps you can implement an action that sends the eject keycode? I think iSSH has a feature where you can tap the onscreen keyboard icon to bring it up even when a bluetooth keyboard is connected.

Related

Ionic Android Strange routing when physical key is pressed [Honeywell CK65]

We are developing Ionic android app and we are having a strange problem with Honeywell CK65 device, to be more specific with device physical keyboard.
If the app is being used only by touch, without device physical keyboard, the app is working correctly.
But when physical keyboard is used, example
when ENTER key is pressed, it should navigate to another page but the remain freeze and it appends on the bottom page the previous page.
Any help will be appreciated. thanks in advance.
You need to somehow configure the app to use the devices keyboard. My guess is that you need to create a custom plugin to call the device's built in keyboard and map those keys to a function.
We resolved the problem using ionic ion-router-outlet instead of angular router-outlet

How to enable Bluetooth with a button OSX

Is it possible to enable Bluetooth (with Discoverability on), using a button on macOS? Or enable it when an application opens? I've looked around online for a solution but everything directs towards iPhone and iOS Development rather than anything on the Mac side. Everything that is geared towards iOS also states that it is not possible on the mobile devices, but it is possible to display an alert notifying the user to turn on their Bluetooth to use their accessories. Is any alert type possible?
Edit: The closest I could get to this was opening the Bluetooth pane of the System Preferences programmatically.
It's a private API.
Add the following to your bridging header:
void IOBluetoothPreferenceSetControllerPowerState(int);
And call it with 1 to enable or 0 to disable:
func setBluetooth(on: Bool) {
IOBluetoothPreferenceSetControllerPowerState(on ? 1 : 0)
}
setBluetooth(on: true)
Don't forget to import IOBluetooth in your Swift file.
To get the current status use int IOBluetoothPreferenceGetControllerPowerState();

How to simulate the very first start of an app in Xcode 6

I need to test some behaviors of the iOS 8 at the very first start of my app. Is it possible to simulate this in Xcode 6? If yes, then how?
Deleting the app will do it but note that certain pieces of information will be cached for a while like your permissions settings (notification, calendar, etc.). You can go to settings.app and reset settings to clear those out if that matters in your use case.
If you mean the FIRST start of the app, then what I did to achive this is, on start (viewDidLoad) check in the NSUserDefaults for example ,if the value "hasAlreadyStarted" exists (NSUserDefaults.objectForKey(..) ), if not, then its the first start of the app, and then i would set the value to true, so when you close the app, and open again, the value will exist.
Dareon I'm not sure what exactly you want to achieve. In Xcode 6 yes you can simulate your app from start. If you want to test behaviours I think you are looking for instruments. Right Click on the Xcode icon in your dock select option and choose instruments. You can add several instruments your phone or emulator support like connectivity or gps or memory to see exactly the behaviour of your app. Hope that helps
Well if by very start of the app cycle you mean before the app loads, there is a way.
In your ViewController call the ViewWillLoad function:
class ViewController
{
override func viewWillAppear(animated: Bool)
{
// your code
}
}
This event will be called before the view loads or appears.
Hope it helps :)
As Shanti K said in the comment, if you delete your application from the simulator and then run it again, you will be simulating the first run. To delete the application from the simulator, you mimic the same behavior on a device.
Click and hold on the icon, until they start shaking. Click the close X next to your application, and verify that you want to delete it if it asks. Then Shift + Command + H to simulate hitting the home button.

How to quit the app through a button?

I want to provide a quit button. There are lot of solutions but not the a proper one. Please help
From a UX standpoint, it's better to let your users quit by pressing the home button, rather than providing a close button.
From the iOS HIG:
Don’t Quit Programmatically
Never quit an iOS app programmatically because people tend to interpret this as a crash.
-(IBAction) buttonPressed {
exit(1);
}
ciao
please don't do it!!!
You should not do it. iOS prohibits it.

How to punt on making a view accessible via VoiceOver?

I'm working on making my iOS app accessible to vision impaired users. On one screen of my app I'm showing an image of sheet music, with a toolbar button which toggles the view to just show the lyrics. Eventually I would like to provide a braille version of the sheet music to visually impaired users, but for now I'm only providing an accessible version of the lyrics.
Until I can take the time to provide a good accessible version of the sheet music, what would be a professional, appropriate way to say via VoiceOver, "Sheet music; tap the lyrics button for VoiceOver content"? How would you word it, and would it be the label, the value, the hint, or something else?
very cool idea, and kudos on making your apps accessible!
Have you looked through the headers in UIKit to see what is available for the accessibility API? this probably the best place to start, as well as the accessibility programming guide on developer.apple.com
You can make VoiceOver speak by posting notifications:
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, #"tap lyrics button to toggle...");
However, in this case it could be better to implement the accessibility API on the specific objects in question. For example, on the UI button that toggles your sheet music, you could do something like:
- (BOOL)isAccessibilityElement
{
return YES;
}
- (UIAccessibilityTraits)accessibilityTraits
{
return [super accessibilityTraits] | UIAccessibilityTraitButton;
}
- (NSString *)accessibilityLabel
{
return #"Toggle sheet music";
}
- (NSString *)accessibilityHint
{
return #"Double tap to toggle sheet music";
}