How to create plist for Uinavigation tableview - iphone

Am having the task like in UITableView, In root view i have country list if selected the country it should navigate to next view display the state list of that country, if i select state it should navigate and displays the cities, if i select city need displays a popular areas and then hospitals list in that area how do i create plist for that. Then how shall i get value from that plist.

For this you can create PList as follows:
add independent rows for each country. Each row set value type as array. And values add multiple rows & put state and for value again put data type as Array. And put respective cities into that.
It will work for you then.
there are more ways to do it but in this case you'll get all data in a single dictionary and you can maintain your table easily using it.

Related

How to count the selected categories or converting the selected categories into a string array

since I am not able to post an image. I'll just type the row for the categories. So here is it:
Categories
1-4-5-10-13-27-28-29-34-35-36-51-58-59-60-61-150
1-4-5-10-13-27-28-29-32-34-35-36-51-58-150
this categories are displayed in a grid
i would like to count how many categories where selected by the user. How would that be possible.
I am doing this because I want the selected categories to be in the selected side in the DualListField
Get the selection model either from the fromView or the toView. Then retrieve the selected items from this model.

How to create Grouped UItableview Alphabetically

I am working in an app in which I have an array and using that array that comes as response from JSON in the table view .Now In table view I want Sections in which i get the value from the array Alphabetically.For say if the Array element starts with A then it should go on A section and similar for all other alphabets from A to Z. How can i do this?

How to iterate through an NSArray of objects and create a new NSArray containing a subset of the original?

I am working on a basic iPhone app that pulls restaurant objects from a SQLite table, and displays them for the user in a table. My app is navigation based. I have no problems pulling the data from the SQLite database, and then sorting them. That I am able to do no problem. Each restaurant object has various properties, like "name", "address", "category" (i.e. the type of restaurant like greek, italian), and others. Now, after retrieving the records from the database, I am able to successfully put them into an NSMutableArray, and then sort them into an NSArray.
My question is, using this NSArray (or the original NSMutableArray), I'd like to create another array, with the first index containing "All", and then each remaining index contain the unique name of the category of restaurant from the original list, sorted in alphabetical order, and then present this as a table to the user on the next screen. From this table, if the user selects "All", the user will be taken to another screen displaying another table where they can see all the restaurants, regardless of genre.
If however, the user selects a particular category from the available list, the user will be taken to a screen that displays a table composed of only those restaurants of that type (e.g. only Italian restaurants, only Chinese restaurants, only Thai restaurants). How would I go about doing this? Any ideas or suggestions?
One possible algorithm outline:
Iterate over your NSMutableArray (e.g. for(item in array)) inserting the category property of each item into an NSMutableSet (or an NSCountedSet if you'd also like the number of times each category occurs)
Use the NSSet sortedArrayUsingDescriptors: method to obtain a sorted array of the categories.
Add the All entry in whatever way suits

custom tablecell valueForSelectedRow problem

I have created a custom uitablecell which contains several values. When the user selects a row, I want to be able to select that row's content for one of the values in the custom uitablecell. If the cell looks like this:
ba_type varchar2(20) P
source varchar2(20) P
row_qual varhcar2(20)
If the user has selected the 'source varchar2(20) P' row, I want to be able to grab the value of 'source' out for my next query.
thx,
wes
Strictly speaking, you've created a tableview cell that displays several values. Sitting in memory somewhere behind that is an array that contains the actual data. That's how MVC architecture works.
Ideally, you have some data structure in memory that corresponds to the cells. If you had an NSMutableArray in memory, you could retrieve the value by doing
// assumes one section in the table view
NSString* sourceForNextQuery = [dataSourceUsedToPopulate objectAtIndex: indexPath.row];
inside didSelectRowAtIndex
If you insist on retrieving the text from the label in the table view cell, when you create the label that contains it, add a tag (mySourceLabel.tag = 999). Then find that tag again by using searching for the tag, the get the text (UILabel.text)
But really, you want to separate the presentation of the data from the underlying model, and have the controller contain the data.

Have a jcombobox filter a jtable

following this tutorial http://www.netbeans.org/kb/docs/java/gui-db-custom.html#enhancements
it shows how to use a textbox to filter out the master table. Could anyone instruct me on how to do a similiar thing but use a dropdown to test against a specific column?
(ie a dropdown of countries, to filter by the country column?
thanks
depending on what the source is for the dropdown.
i assume the dropdown isn't used as part of the Jtable itself, but merely shows a list of unique data coming from one column of data?
in that case, you could get the Jtable's datamodel, and then walk through all the cells in the particular column, putting them in a hashmap with the string as the key. that way you have a list of (unfiltered) unique strings to use as the datamodel for the dropdownbox.
You could attach a model listener to the talbedatamodel to know when your list has to be updated as well.