iPhone Settings Bundle - Read-only setting - iphone

Is it possible to have a read-only setting (from the user's perspective, but read/write from my app) in the settings bundle. I'm looking to display something like:
Registered: YES/NO
But I don't want to show a switch because I don't want the user to be able to change this.

The title type displays a read-only string value. You can use this type to display read-only preference values. (If the preference contains cryptic or nonintuitive values, this type lets you map the possible values to custom strings.)
The key for this type is PSTitleValueSpecifier.

No.
For the app to have read write ideally it needs to be in the Settings.bundle which goes into the Documents folder. You could just disable user interaction on the switch?

In Xcode 4+ set the type to title of the textfield.

Related

Defining custom state list

When I attach Interactable component to my prefab, I can choose one (or more) of 4 state blueprints, such as DefaultInteractableStates.asset. Although it contains 4 defined states, I would need to remove "Default state" from that. Is there a way I could define my own list of states? I can see the - button to remove state, but the asset is read-only, so I cannot edit it.
This looks like MRTK
=> in general all the original profile assets are read-only protected.
You always need to make a copy/clone of whatever profile you want to change and edit the copy instead and assign the copy to your profiles.
Also see How to configure Interactable.

Why are there two places to specify the App Icon File?

The App Icon File is defined in the plist as well as in the Info Tab of the target.
Is there any reason for this or is it just redundant?
This is just two different places for the exact same setting. Changing it at one place will change it in the other location.
The same is true for the "Bundle Identifier", "Version" and "Build" fields in the Summary tab, which will change the values in the Info.plist.
Actually quite every piece of information present in the "Summary" tab is just another way to present common information present in the Info.plist file, it is just a more readable presentation of the exact same info. And same for the "Info" tab, which present the Info.plist keys directly, and extract some special keys like Document Types, UTIs and URL Types in a separate view: everything in there is just another presentation of the Info.plist file too.
Special note for the "Icon" attribute: there are various ways to define the application icons in the Info.plist keys due to evolution across the various SDKs. And the icon in the "Summary" tab only affect the latest way to define icons.
At start there was only one key CFBundleIconFile of type string that defined a unique icon name. Simple enough.
Then another key CFBundleIconFiles has been added to accepted a list (NSArray) of icons, to support multiple resolutions and usages (Search icon, etc)
Finally, in iOS5, another key was introduced again called CFBundleIcons that is now a dictionary that allows you to list each icon file and its associated purpose (Newsstand icon, Search icon, App Icon…)
For more details, read the Information Property List Key Reference which explains the differences in detail.
Removing the items in one place causes them to be removed at the other place as well. So I guess it is redundant. Also dragging and dropping the icon files into the "App Icons" slots under the target's "Summary" tab achieves the same effect.

How to add button to settings.bundle?

I'm developing an iPhone app, and by default user keeps logged in. If he wants to logout, he should open the Settings and click a "Logout" button which would erase his data and ask for a login the next time app is opened. How do I add a button like this? As in twitter settings
As CodaFi said it is not possible. However it could be a good workaround to use a toggle switch for "keep me logged in". And when the user turn it off you can show the login screen on next launch.
Unfortunately, this is not possible using public APIs. Bear in mind that Apple reserves many, many undocumented (and exceedingly cool) features for it and it's partner's applications. You are limited to only the following:
Text field: The text field type displays a title (optional) and an
editable text field. You can use this type for preferences that
require the user to specify a custom string value. The key for this
type is PSTextFieldSpecifier.
Title: The title type displays a
read-only string value. You can use this type to display read-only
preference values. (If the preference contains cryptic or nonintuitive
values, this type lets you map the possible values to custom strings.)
The key for this type is PSTitleValueSpecifier.
Toggle switch: The
toggle switch type displays an ON/OFF toggle button. You can use this
type to configure a preference that can have only one of two values.
Although you typically use this type to represent preferences
containing Boolean values, you can also use it with preferences
containing non-Boolean values. The key for this type is
PSToggleSwitchSpecifier.
Slider: The slider type displays a slider
control. You can use this type for a preference that represents a
range of values. The value for this type is a real number whose
minimum and maximum value you specify. The key for this type is
PSSliderSpecifier.
Multivalue: The multivalue type lets the user select
one value from a list of values. You can use this type for a
preference that supports a set of mutually exclusive values. The
values can be of any type. The key for this type is
PSMultiValueSpecifier.
Group: The group type is for organizing groups
of preferences on a single page. The group type does not represent a
configurable preference. It simply contains a title string that is
displayed immediately before one or more configurable preferences. The
key for this type is PSGroupSpecifier.
Child: pane The child pane type
lets the user navigate to a new page of preferences. You use this type
to implement hierarchical preferences. For more information on how you
configure and use this preference type, see “Hierarchical
Preferences.” The key for this type is PSChildPaneSpecifier.
If you don't mind using the 3rd-party add-on "InAppSettingsKit" for your app's Settings, then it looks they would allow you to do what you need. I'm currently studying up on this myself, but from a quick scan through their documentation it looks like they would allow you to add buttons as well as completely custom child pane views: http://www.inappsettingskit.com/
On that page, study the sections "IASKButtonSpecifier" and "Custom Viewcontrollers".
I'll post a follow up here to let you know how this worked out for me. I'm using the InAppSettingsKit already, and love it so far.
Download the code and sample app from Github: https://github.com/futuretap/InAppSettingsKit
Then open the InAppSettingsKit.xcworkspace in your XCode and study how they implemented the various different types of Settings entries. They definitely support what you are looking for. It's really quite impressive.
Erik

How to check if a word is defined in the English dictionary in cocoa-touch?

I am trying to make a crossword app for IOS but i Don't know that how to check if a string is valid english word or not.
How can i check it.
Is there any API or online facility to check it.
Thanks in Advance
Easy to do in iOS5 using the UIReferenceLibraryViewController class' +dictionaryHasDefinitionForTerm: method.
A UIReferenceLibraryViewController object provides a dictionary
service to look up the definition of terms. You create and initialize
a reference library view controller using the initWithTerm: method.
You pass the term to define as the parameter to this method and the
definition is displayed. You can present this view controller modally
or as part of another interface. On iPad, you can set the reference
library view controller as the content view controller of a
UIPopoverController object. Optionally, use the
dictionaryHasDefinitionForTerm: class method to check if a definition
is available for a given term before creating an instance—for example,
use this method if you want to change the user interface depending on
whether a definition is available.
There is no API for this.
In order to do this, you will need to have a dictionary file (text file or database) in your application bundle. One of the faster ways to check will be to load the dictionary into memory when the application launches so you don't have to read the file for each word. This may be overkill if you simply want hardcoded crosswords, but if you are randomly generating them then this is a must.

How to add a label in a settings screen

As a picture says more than a thousand words:
alt text http://img.skitch.com/20091008-k16k7we3t43gj3h7htgtjpunpx.jpg
Any help on how to add descriptive labels to a settings pane would be highly appreciated!
I should point out that I want to do this to be in the iPhone-App settings that are in the Settings menu of the iPhone (outside the App).
Example label:
iPhone -> Settings -> Safari -> Fraud Warning
The label beneath: "Warn when visiting fraudulent websites."
For reference: Since iOS4.0 and above a FooterText key was added to PSGroupSpecifier that does exactly what you are looking for.
http://developer.apple.com/library/ios/documentation/PreferenceSettings/Conceptual/SettingsApplicationSchemaReference/SettingsApplicationSchemaReference.pdf (pg 11)
Unfortunately, Apple has not given iPhone developers the capability to add the kind of label you're looking for in Settings.app. As a near approximation, I've used PSGroupSpecifier under another setting element (such as PSToggleSwitchSpecifier). It's not as elegant as a true label, but it worked well enough in my situation (I only had one setting, so it didn't conflict with any other group headings).
alt text http://pseudorandomengineer.com/images/6.png
Try using a PSTitleValueSpecifier in your settings bundle's plist. I'm not sure how that formats itself—most likely bold, like the group headers—but it might be what you're looking for.
If you want to simulate a label that is center-justified, add an empty title PSGroupSpecifier and put your label text in the FooterText Key.
Check out the tableView:titleForFooterInSection: method of UITableViewDataSource. You can return a string to be displayed below a table view section. If you're already using a UITableViewController subclass, just implement that method and you're good to go.