"show 20 more messages" button in uitableview - iphone

I am newbie to iphone programming. I doing an mail like app in that i have to show inbox information in table view and at the final of dragging i should need "show 20 more messages" button. is there possibility of showing that?
if please can you provide with me a codes.
Regards,
sathish

Sure, you just have to manage it manually:
Add one extra row to your table view.
In tableView:cellForRowAtIndexPath:, if the indexPath corresponds to the last possible row (which is the extra row you added), create a cell that represents the button.
In tableView:didSelectRowAtIndexPath:, if the indexPath corresponds to the last possible row, have your datasource load the additional data and send a insertRowsAtIndexPaths:withRowAnimation: to your table view.

Related

Hide some UITableViewCells when editing?

Background
I'm really struggling to work out how to handle editing mode of a UITableView and hide some rows in when editing commences.
I'm using a grouped table view style with multiple sections and multiple rows per section. The last row of each section is titled "Add new...".
The idea is to allow the end user to click the "Add new..." row within each section and then be taken to a new screen where they fill in some fields and then are returned to that tableview with their new row added within the relevant section. So the last row does not really relate to the datasource and is more of a UX thing.
I've managed to get the Add row appended to the end of each section.
The problem
I have a button that calls: tableView setEditing:animated: and this insets all the rows and adds a delete icon to the left of each row.
What I don't want to do is allow the user to delete the "Add new..." row. So my orignal thinking was to just remove the delete capability for those "Add new..." rows using the tableView:canEditRowAtIndexPath:.
This worked but looks really crap as all the rows are inset apart from the "Add new..." rows.
So my current thinking is when edit mode commences just remove the "Add" rows from the table view and then when editing mode finishes add them back again.
I tried to do this by traversing all the rows when the user clicked the edit button but it seems you can only get rows that are currently visible using cellForRowAtIndexPath:.
So I can remove the ones that are visible but as soon as the user scrolls down the tableview the add buttons are still there for the sections that were not visible (at the time editing was initialised).
Help!
Does anyone know how I can just hide the "Add" rows from each section when the user edits the table and then add them back after?
I'm looking for the same functionality that the contacts app uses when the user edits a contact.
Actually you did already close the answer, just use the method cellForRowAtIndexPath to pick up the cell you want to hide, and set its hidden property to YES. You make it!
Oh, I am sorry that I had not noticed you are using the group style, so my suggestion is that you can try to separate the add button to the others, like include it in a single section.
You can display a green (+) button on the "Add line" row so it lines up with the deletable rows.
Simply override -tableView:editingStyleForRowAtIndexPath: in your table view delegate and return UITableViewCellEditingStyleInsert for that row.
What about removing the Add line(s) from the actual data source and just calling [tableView reloadData] then when edit mode changes back, add them back into the data source and reloadData again.
return YES from canEditCellAtIndexPath for every cell in the section then in override
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {} and return UITableViewCellEditingStyleNone for the "add line" row else return UITableViewCellEditingStyleDelete

Check Mark on table View

I want it to have folders on a table view. And i mean folders like when one cell is selected, a new page opens up and its only for that one cell. I need help with the checkmark i want when the cell is selected. when the cell is selected, i want it to go to a new page and i want that cell to have a checkmark on it as it goes to the new page, and when we come back to this view, i want the checkmark to vanish so we can select another cell. Any help would be greatly appreciated!! Thanks, Kurt
You can use the accessoryview to make a checkmark, and indicate them with a BOOL when visited. Maybe even remember this information by storing the bool in a NSUserpreference

getting some values in the table view rows in an iphone app

hii every one
i am new to iphone, i have done a sample data entry project in that i am saving data into the sqlite then displaying the saved data in the table view , & then on click of each row of the table it will go to other page (grouped table view where i am displying detailed data) now i have the table view like this
on click of each row it will go to detailed view like this
then on click of back button it ill come back to data list screen but it ill add some other data into the screen like this
i am using reload data in view will apear ,, is that causing this problem?it works fine if i comment that n try,,
can any one help me
thanx in advance
When you add new row in the table upon back button press, you can either add a new row in the table using
insertRowsAtIndexPaths:withRowAnimation:
or update your array (adding this extra row) with the help of which you show the rows and then reload the table view. Because when you reload your table view, its datasource methods will be called again and then you need to return updated number of sections, rows and cell's
Check your array values in didSelectRowAtIndexPath delegate whether you have different arrays or not.
If yes then use [yourArray objectAtIndex:indexPath.row]

How to use first responder to keep only one cell selected at the maximum in a view with multiple table views?

I have a scrollview which has several table views as sub views...
say that I have selected a cell in one of the sub views. Now when I select a cell from another view, the cell I selected previously should not be highlighted.
How do I do this? I know I can do this using the first responder, but I am not sure how to do it.
Would anyone be able to help me out in this?
Thanks
From the apple interface guidlines:
Always provide feedback when users select a list item. Users expect a table row to highlight briefly when they tap a selectable item in it. After tapping, users expect an immediate action to occur: Either a new view appears or the row displays a checkmark to indicate that the item has been selected or enabled.
In rare cases, a row might remain highlighted when secondary details or controls related to the row item are displayed in the same screen. However, this is not encouraged because it is difficult to display simultaneously a list of choices, a selected item, and related details or controls without creating an uncomfortably crowded layout.
I don't think apple will approve an app that leaves a row highlighted (I had an app reject for that very reason). You should perform an action and then immediately unhighlight it. In some rare cases you can leave it highlighted while showing a related view.
However, if you store the current cell you have selected, you can call -deselectRowAtIndexPath:animated: on the tableview to deselect a row.

iPhone Dev: Get more data functionality in twitter iPhone clients?

I'm building an app (not necessarily a twitter client) and I'm trying to figure out how developers create the buttons above and below a table view where a user presses them to either reload newer data or reload older data into a table view. Does anyone know of any tutorials out there that does this or know of an easy way?
If you want fixed buttons, you can just make your table view not use the full screen and add the buttons in the space. If you want the buttons to scroll with the table view, you can add a header or footer view to the table and put your buttons inside that.
Check the Three20 project. I believe there's a tableview there that does that.
It's actually not that hard to add inline buttons to a tableview. First you check and see if there's actually more data to show. If so, you want to add 1 to the number of rows returned from the datasource. When asked to draw that last row you return a cell that contains "Press for more" caption as well as a hidden spinner instead of the standard cell that shows your normal data.
If the user presses that last button the table view handler turns on the spinner then fires off a network event. Once the network request completes the data is processed and added to the same tableview datasource that was used to draw the first table.
Now all you have to do is tell the tableview to reload itself and the new data will show up. If you want to limit the amount of data shown you can prune out N number of items from the head of the datasource before redrawing so the memory-use stays manageable.