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]
Related
Iv got a mac application that uses a table view on the left side of the window as the navigation, and then another table view on the right that shows the relevant information.
I do this by just checking what cell is selected on the left table view and use that to update the information on the right.
The problem is when the table views load they dont have a row selected, the selected row shows up as -1 (AKA nothing) i need the table view to have a row selected when the view loads, not just after someone selects it. Kinda like the finder window, when you open the application it has a row already selected.
And no i dont want to just change the background color of the cell so it looks selected when the app opens, because that wont fix the -1 problem.
You cans select a row programmatically using the API on NSTableView:
func selectRowIndexes(_ indexes: NSIndexSet,
byExtendingSelection extend: Bool)
Let us say, you want to pre select the 0th row, then you can need to call the above API as in viewDidLoad method:
tableView. selectRowIndexes(NSIndexSet(index:0) byExtendingSelection:NO)
I am making a simple gaming app, implementing a tab bar controller. The second tab, or high score page is what I am having problems with. I am able to populate the UITableView with an initial array of objects, however I can't seem to add new cells. Now I read about User entered cells, but how exactly would I extract the winner from one tab to populate the UITableView in the high score tab? Thank you for your time!
For adding new cells to your UITableView, the most straightforward way would be by simply reloading the entire table view [UITableView reloadData].
Assuming that you are storing the cell-contents in a mutable array, simply add those new entries to that array and reload the table.
You can update your array and call reloadData on table view to reload it and also if you want to add cell at a specific position you can use
(void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:
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.
I am new to iphone Development. I am parsing XML into a mutable array of strings which displays dynamically in a table. I am not able so see the content in the table but as soon as I scroll down the contents are displayed. Please help me out.Thanks
Can't say for certain without seeing the code but it sounds like – tableView:cellForRowAtIndexPath: returns empty cells at first. Most likely it does so because your datasource, in this case the xml parser, has not yet provided data for the cells when the table first loads.
The table only populates the visible rows and then stops. It only fetches more data when you scroll and new cells become visible. In your case, it sounds like the table has no data when it first loads but in the time it takes you to manually scroll it, it has found the data.
You probably need to call reload on the table to force it load the data. Even better, you should alter your design to make sure it has some data to display before the table itself loads. If that is not possible, you should have some placeholder information in the cells e.g. text that says "Loading Data..." and then call reload.
The problem is that when you finish parsing your XML file, you don't reload your table that is already visible.
You have to use something like [myTableView reloadData]; right after finish parsing the XML file.
Cheers,
VFN
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.