Add a checkbox (or similar) to iPhone app using XCode - iphone

I notice in Objects Library when I'm in editor, there are checkboxes. But they disappear when I go to the storyboard. So is there a way to add a chechbox in iPhone interface or are they meant for other platform? If it's not possible, is there something else that could do the same job? I'm making a search function and I want a criteria to be added in the search if the chechbox is checked, that's why I need something like that. Thanks.

Checkboxes are for OS X. The iOS equivalents are switches. If they aren't appropriate, you can roll your own checkbox using buttons.

Related

How to build Insert Remove Form with Xcode Object Library for Cocoa Swift?

Rocket for Mac has a Preferences Window in which it has a form like below to insert & remove an app.
I want to make a form like that but how should I build it? I am new to Cocoa development so this might be obvious.
I want to make the one with the label Disable Rocket within these apps:
I found a solution.
What I did was use NSTableView with single column for the textbox. And made the NSTextField in it to be text editable using the Behaviour attribute.
Then for the + & - button I used 2 NSPopupButton & made the Image attribute to be NSAddTemplate & NSRemoveTemplate which exists by default in Xcode. There are bunch of other images that are default in it.
That solved it for me :)

Swift - disable accessibility voiceover?

I was curious if there was a way to disable the voiceover accessibility (or any other type of accessibility feature for that matter - like hear aids, captioning, etc.) in swift?
Essentially, I'm trying to build an application that has a very high likelihood of being used by people with visual impairments and I've tailored my entire application for such people.
But given that this target group may have the voiceover accessibility feature on, can I disable that only within my application?
I see that on xcode 7, underneath the identity inspector, there is a section for accessibility (picture below) and I tried unchecking that box but it seems like voiceover and the highlighting focus feature are still in effect. Let me know if you have any suggestions or comments, thanks.
You can set
element.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction
on any elements that you want to provide custom audio/interactions for.
This can also be accomplished in storyboard (See photo).
I came across this thread because I was trying to do this for on a game scene tucked inside of a view container. To get it to work, I was able to set
.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction
on each SKNode that had custom accessibility created for it, and then was able to select the proper options (again see screenshot) on the SKView -> View in Storyboard to allow the game screen to work.

Is there an existing iOS component to type in a UITextView? [duplicate]

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement

What is the equivalent of a C# drop down combo box on iOS?

I am writing an application using Objective-C for iPhone.
In this application, the user, while entering a new record, needs to have a lookup capability (such as state, gender, phone type, etc). In C# i usually use a drop down combo or something like that to accomplish this task. What is the equivalent in Objective-C? Can someone show me a sample application?
Take a look at UIPickerView. It uses a spinning wheel to show a set of values that can be selected by the user. You need to create an object that adopts the UIPickerViewDelegate protocol to handle responding to what the user selects, and an object that adopts UIPickerViewDataSource protocol to populate the picker view.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPickerView_Class/Reference/UIPickerView.html
The equivalent would be a UIPickerView
If you want to choose a date then use UIDatePicker.
UIPickerView is pretty much the same thing as a dropdown combo box, except without the dropdown part
I prefer to use UIActionSheet. Works quite well as combo box.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIActionSheet_Class/Reference/Reference.html
there is an iOS combobox api that might help you add a combobox component to your app. Check it here: http://www.chupamobile.com/products/details/365/ZComboBox/

Is there an iPhone equivalent to the NSTokenField control?

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement