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
Related
I have created a new stereotype based on "Requirement" and has exported it as profile. When I double click on an instantiation of that type, a menu appears that contains the default properties of the type "Requirement". It contains some tabs (e.g. the "Files" tab) that are useless to me.
Is there a way to eliminate this tabs?
How can I modify the default tabs of the properties dialog (open by double click on an element)?
A word of warning: be careful when stereotyping Requirements - the relationship between the element stereotype and the requirement types configured into the project (Settings - Project Types) is a bit murky.
That said, there is no way to modify EA's dialogs. What you can do is create your own property dialog and have EA open that when the user double-clicks the element.
In order to achieve this, you need to create an Add-In which catches the Context Item Event EA_OnContextItemDoubleClicked. In your event handler, return true to inform EA that you're handling the event (which prevents EA from opening the default property dialog), and open your own custom dialog.
The same event is fired when the user hits Enter with the element selected. The default property dialog can still be opened by pressing Alt-Enter.
As an alternative, you might want to look into the third-party extension eaForms, which allows you to create your own custom property dialogs without writing your own Add-In.
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.
GWT's Editor framework is really handy and it can not only be used for editing POJOs but also for read-only display.
However I am not entirely sure what the best practice is for doing inline edits.
Let's assume I have a PersonProxy and I have one Presenter-View pair for displaying and editing the PersonProxy. This Presenter-View should by default display the PersonProxy in read-only mode and if the user presses on a edit button it should allow the user to edit the PersonProxy object.
The solution I came up with was to create two Editors (PersonEditEditor and PersonDisplayEditor) that both added via UiBinder to the View. The PersonEditEditor contains
ValueBoxEditorDecorators and the PersonDisplayEditor contains normal Labels.
Initially I display the PersonDisplayEditor and hide PersonEditEditor.
In the View I create two RequestFactoryEditorDriver for each Editor and make it accessable from the Presenter via the View interface. I also define a setState() method in the View interface.
When the Presenter is displayed for the first time I call PersonDisplayDriver.display() and setState(DISPLAYING).
When the user clicks on the Edit button I call PersonEditDriver.edit() and setState(EDITING) from my Presenter.
setState(EDITING) will hide the PersonDisplayEditor and make the PersonEditEditor visible.
I am not sure if this is the best approach. If not what's the recommended approach for doing inline edits? What's the best way to do unit-testing on the Editors?
If you can afford developing 2 distinct views, then go with it, it gives you the most flexibility.
What we did in our app, where we couldn't afford the cost of developing and maintaining two views, was to bake the two states down into our editors, e.g. a custom component that can be either a label or a text box (in most cases, we simply set the text box to read-only and applied some styling to hide the box borders).
To detect which mode we're in, because we use RequestFactoryEditorDriver (like you do), we have our editors implement HasRequestContext: receiving a null value here means the driver's display() method was used, so we're in read-only mode. An alternative would be to use an EditorVisitor along with some HasReadOnly interface (which BTW is exactly what RequestFactoryEditorDriver does to pass the RequestContext down to HasRequestContext editors).
Yes,Presenter-View pair should be. But Here two ways to achieve this feature if you like to go with:
1) Integrate Edit/View code design in one ui.xml i.e.Edit code in EDitHorizonatlPanel and View code in ViewHorizontalPanel.The panel has different id. By using id, show/hide panel with display method. if getView().setState() ==Displaying then show ViewHorizontalPanel and if getView().setState()==Editing then show EditHorizontalPanel.
2) Instead of using labels, Use textboxes only. set Enable property is false when you need it in view mode otherwise true
You have created two Presenter/view but I think if Edit/View function has similar code so no need to rewrite similar code again and again for view purpose.
If a big project has so many Edit/View function and you will create such type of multiple View/Presenter than your project size become so huge unnecessary.
I think that whatever I have suggest that might be not good approach but a way should be find out which help to avoid code replication.
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.
I would like to be able to control the initial shift state of the iPhone keyboard from a Javascript prompt (updates added for web forms). It seems to mostly default to an initial capital but I feel sure I've typed into/seen prompts that are initially lower-case. I also feel sure that I've seen custom layouts used from the web.
Googling around initially (see updates) didn't reveal any obvious documentation or previous answers besides saying that having "phone" or "zip" in the class of the input would bring up the numeric keyboard (although this may have stopped working). Apparently "url" or "email" could select the appropriate layouts also. This obviously doesn't apply to javascript prompts, and may not work in some versions.
Is there any official source for all this stuff? Does it work across all firmware versions? Has anyone got a general solution for changing keyboard layout or for doing this in Javascript prompts?
UPDATE
For web forms: found this from Apple straight after posting the question, along with this. The question still stands for Javascript prompts.
UPDATE 2
Doh! This is also useful; placeholder text and search button not mentioned in the Apple links. Some more relevant info here.
How do I control which keyboard is displayed when a user touches a text field?
You can control which type of keyboard is displayed when a user touches a text field in a web page. To display a telephone keypad, an email keyboard, or a URL keyboard, use the tel, email, or url keywords for the type attribute on an input element, respectively. To display a numeric keyboard, set the value of the pattern attribute to "[0-9]" or "\d".
These keywords and the pattern attribute are part of HTML 5, and are available in iPhone OS 3.1 and later. See Listing 15 to see how to display each type of keyboard, including the standard keyboard.
Listing 15: Controlling keyboard display
Text:
Telephone:
URL:
Email:
Zip Code:
See http://developer.apple.com/library/safari/#codinghowtos/Mobile/UserExperience/index.html