sort elements of a table view in sections - iphone

in my app I have a table view where I download a list of hotels parsed by an XML(for every hotel i put in xml an attribute STARS); I need to view hotels by stars (from 5 stars to three stars), dividing it into three sections.
So I have a section "5 stars" where there are 5-star hotel, a section "4 stars" where there are the 4-star hotel and thus also for the 3-star hotels.
How can do this??

I'd go with three separate arrays to hold your data, and then use your delegate to answer 3 for the number of sections, and populate the cells accordingly.

Related

Multiple Collapsable Sections with non-collapsable sections divided by headers

So I have been scouring the internet but can't find the solution. Currently I have a tableview with collapsable sections, the rows within these sections are off course related to the section. I have two other categories that don't need these collapsable sections, these are just rows. Currently I have a segment control that has the following:
Category 1 (Collapsable sections with each a different number of rows)
Category 2 (Standard list of rows)
Category 3 (Standard list of rows)
Category 4 (all of the above)
Category 1-3 work fine. But I can't combine all in one view. I would like to have three headers with each showing their corresponding category. First header should show all sections that are collapsable. The other two just rows.
What I tried:
Using section count to give each category a header but this ends if giving a header to all sections individually.
Using section count to give each category a view.
Potentially, creating three TableViews for each category if all Segment is selected.
Can anyone help in the right direction to what would be the best solutution.
I don't think my code will help because I'm still not sure what method I should use.
I did make a drawing to show what I mean:
if anyone has an idea that would be fantastic, thanks!

Details sections displaying in wrong order

I am using a database source as a text file, and display the information in six sequential Details Sections:
details1
details2
details3
details4
details5
details6
details1 had too many fields to display on a single row, so I added the last 3 remaining sections.
Now when I generate the report, the fields display in the wrong order. details4 shows after details1 as both has the same formula. Then details2 and details5 show, then details3 and details6. The report gets messy.
Is there any way where in I can display all six sections in their original order?

How to display two grids with different data on the same form

I have a form with two grids. I have one table with rows where each row has a status of Yes or No. I'd like to display all the yes's in the top and the no's in the bottom grid.
A similar scenario would be if I wanted to show SalesTable header records. The top grid would be only those with a status of Delivered, and the bottom grid those with a status of Invoiced.
How can I accomplish this?
I've gotten close by adding another datasource of the same table type. I add a QueryBuildRange to filter the records but I get two issues:
When I click on a row in the top/bottom, it moves both row lines at the same time (the highlighting thing
It wants to show an equal number of top rows as bottom rows for some reason?? If I have 3 delivered sales orders, and 5 invoiced sales orders, it will show 3 in the top and 3 in the bottom.
Seams like the Grid-controls are being controlled by the same DataSource.
Check the properties of the Grid-control: make sure they are not set to the same DataSource!
Anyway, it would be helpful to know how the Form is structured and how the QueryBuildRange was added.
I created a very simple Form and it worked correctly:
added two Datasets with T-SalesTable each
added two Grid-controls to the Design (or to a TabPage, both worked)
adjusted the DataSource-property of each Grid to point to each DataSource
added fields (the AutoReport group) from the corresponding DataSource to each Grid
this one worked correctly (despite having the same contents. Then I
added a range in the init method of each of the Datasets
and it still worked.

How To customize different rows in UITableView

I want to create a page in iphone sdk which looks same as flight search result
problem is that each there are different number of stops some has 2 stops some has 1 etc. and not only leave flight detail but return flight detail can also be asked.
It must sorted on the basis of charges.
I am not getting from where I start
I make 3 custom cells
showing source n destination detail
the flight detail
to make separator between leave n return results
this is demo i have tried with fixed value! [1 row a SimpleTableIdentifier(background color not able to set) 2 and 3 row are 2 different CustemCell, there is separator custom cell too]
but I think i make it complex unnecessary
any tips and help will be apprecited thanks in advance.
Go like this make three customCell one for each of your three category
cell structure to show source and destination detail
cell structure to show flight detail
cell structure to make seperator
Now your UITableView will be a grouped tableView with numberOfSections = number to total flight you have to show
Each section will have three rows (if it has all three information available) else you can reduce the number of rows in any section by delegate method of UITableView named numberOfRowsInSection.
Try not to forget to give all different custom cells other dequeueReusableCellWithIdentifier's for re-usability.

Naming Sections in Grouped UITableView

I have a grouped table view with two sections.. I have an NSArray which pulls in 5 section titles from a database, I want the first section in the uitableview to have four rows, whose titles are set to the first four elements in the NSArray and the second section to contain a whose title is set to the last element in the array, how is this possible?
Everything depends on what you return from your data source's tableView:numberOfRowsInSection: and numberOfSectionsInTableView: methods. Sounds like you want 2 sections, with 4 rows in the first and 1 in the second — you can do this by checking indexPath.section in numberOfRowsInSection: and returning the appropriate value. Then in tableView:cellForRowAtIndexPath:, you can use indexPath.section+indexPath.row to get the overall row number.