Adding default values to settings.bundle items? - iphone

I have noticed that some values in settings.bundle (Root.plist) do not allow you to associate a default value with them?
Is there a way to add a default field or is it simply a case of adding the appropriate defaults for these items inside the application using ...
NSDictionary *defaultSettings = [NSDictionary dictionaryWithObjectsAndKeys:#"Kinetic", #"IDBombs", nil];
[userDefaults registerDefaults:defaultSettings];
Just curious if I am doing this right or missing something?

Right mouse click on any row within the item, click Add row on the menu and choose Default value.

Related

save data to popupmenu

I have a popup-menu that has an option, add own material, and when this is chosen, a pushbutton is enabled that say SAVE. I alose have a bunch of edit-boxes.
What I want to do is to make a callback so whenever I click the SAVE, the data from one of the textboxes will possible to select in the popupmenu. when this is selected, I want to set the other edit-boxes to contain the same data that they did when I clicked the save button.
Thanks in advance
I'm not quite sure to fully understand what you want, but you can use the handle of the popup menu to get the string/string array in contains at the time you press the pushbutton. Then you can put those inside the textboxes using their handles as well.
For instance:
MyStrings = get(handlesToYourPopupMenu,'String');
or
MyStringsArray = cellstr(get(handlesToYourPopupMenu,'String'));
which contains the content of the popup menu as a cell array.
and
set(handlesToYourEditBox,'String',MyString);
Is that what you mean? If not please ask :)
EDIT:
To add the new data to the existing content of your text box, use concatenation. Since the content is in a cell array, you can do the following:
NewString = [OldString {CurrentString}];
where CurrentString is obtained with
get(hanlesToYourEditBox,'String');
Therefore to update the content of the popup menu you could write this:
set(handlesToPopUpMenu,'String',[MyStringsArray {get(hanlesToYourEditBox,'String')}]):

Specifying non-editable string in settings.bundle?

I have noticed that some applications add entries into the settings.bundle that simply represent a fixed/non-editable string.
I only see these in the list, and the only one close is "Text Field" but thats editable.
Is there a way to specify this in the Root.plist ?
Indeed you have to use title instead of textField and more specifically in order to produce the example you mention use the following tips:
In settings bundle under Root.plist add a new type title
Set title value to "Version"
In the same item add a new row and set this to 'Default value'
Set Default Value to "1.1.1"
This will produce a non-editable text field with title value on the left and Default value on the right.
Instead of selecting TextField use Title

Default value/Item for SWT Combo

A would like to add default text when the drop-down menu is loaded on my view. How can I do this in SWT and JFace?
I'm guessing what you want to do is to show something in the combo when it has been added to the view (it's blank by default until something is selected or typed).
If you want to set a default text displayed until a selection has been made / until the field has been edited, e.g. - Select option -, then you can use:
Combo.setText(String string)
Note, this is not possible if the Combo is SWT.READ_ONLY
If you want to set one of the values in the drop-down as default use the select method:
Combo.select(int index)

cycle through entries in NSDictionary

Im writing a game that has two sets of buttons. The first set is like blank spaces, and the second set is a custom keyboard.
So I've created a dictionary to keep track of selected buttons (blank spaces) in my interface. The user can select say 5 of these and update all of their titles at once. When the user presses a key (on my custom keyboard made of buttons in a separate subview) I want to change all of the titles to show the letter on the key the pressed.
I have my keys numbered (alphanumerically) from 1 to 26 (ie. a=1, z=26) and the current set of labels on the blanks will be kept in similar numeric form in an array called "currentSolution"
Im imagining i can set up a for loop to go through selected blanks and give them all the title of whatever key is selected in the keyPressed method. Can anyone give me any guidance here? im kinda a noob and dont really know how i should go about this
thanks
You can use (only in ios 4)-
[yourDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id object, BOOL *stop) {
NSLog(#"dic = %# : %#", key,object);
//Do what you want for every object...
UILabel *label = (UILabel*)object;
label.text = #"bla bla";
}
}];
Hope it will help

Hoe put searchbar in each component of UIPickerview? and how perform searching in each related SearchBar?

Actually i used the pickerView for display My database value containing Name, SSN, Research Area etc. Now I need to search in each component of pickerview, like Name,SSN using SearchBar is it Possible?
If I understand you right, you want to filter the rows of the components when the searchtext changed.
You can have a NSArray for each component to populate it with: In – searchBar:textDidChange: you can check which entries in your arrays fit to the search text and add it to a array, that you will use to fill the picker. Don't forget to either call [aPickerView reloadAllComponents] or [aPickerView reloadComponent:i], this will tell the picker to draw itself again.