I am trying to create a list where I want users to enter data in the text view provided above and on they clicking add button it populates in a tableview below. !This is a sample type that I want to create.
sample image
Easy, the IBAction for the Add button should just add the text entered into the text field into an array that powers the UITableView. After adding it to an array, call reloadData on the UITableView, the UITableView will read the new data, as well as the other data from the NSArray and provide data to the list.
Related
We would like to add the Custom Fields Like functionality just like the Address book as displayed in the Picture like the Add New Address and Add new Field.
Using the UITableView what will be the best way to achieve this functionality, if some one can point out to a sample that will be much better.
To achieve such functionality you have to create different type of custom cell according to your need and then while calling CellForRowAtIndexPath you can set the cell to your custom cell, and also you can add new cell and delete the cell from tableview by using tableview Edit method.
To add new row simply add a new value in the data source and reload the tableview and new row will be added to the table.
I am new at iOS development and i have some issue of cellForRowAtIndexPath method of UITableView.
In my application i have multiple rows in UITableView. when i want to see each row then obviously i need to scroll UITableView.also in UITableView i added UITextField to each UITableViewCell . when i add value
of UITextField in DataBase then its work properly but when i want to edit values of UITextField and i add values of TextField in DataBase then problem is created.
PROBLEM :- If i want to add all editable values of TextField in DataBase then i must need to be scroll UITableView up to down. if i do not scroll then invisible TextField is not add in DataBase :( Here in my Application add and editing are in same UIViewController base on ID that i passed.
by Googling i also found that cellForRowAtIndexPath is not called for all rows. It is only called for visible rows and then called for additional rows as the user scrolls to them. Old rows are also destroyed as they go off the screen and it will request the cells again if the user scrolls back up.
so, please help me how can i solve my problem,
EDIT FOR MORE EASY TO UNDERSTAND MY PROBLEM :
For Example :
I have two UIViewController.
1 - FirstViewController
2 - SecondViewController
in FirstViewController display all list of Name in UITableView and it has two choice either select name in UITableView or add new data by tapp BarButton from UINavigationBar .This both processed adding and editing are done in same ViewController called SecondViewController . data (or values) Add by SecondViewController is working properly
But when i select any row ( or name ) from FirstViewController then related ID pass to SecondViewController and all information are display on TextField base on ID. here all values are get from DATABASE and i store it to NSMutableDictionary and then it store on textField by access KEY of Dictionary. but values are store in TextField which are visible. invisible TextField not store values even i get from DATABASE . so i must need to first scroll UITableView.
Thanks in advance :)
Then implement like given below
Get the database value and store it in NSMutableDictionary and accessible through out by declaring in interface or .h file.
Then when each time your tableView or textField loads read the values from dictionary and display.
And in your textFieldDidEnd or textFieldDidChange delegate get the data from textField & save/store back to your dictionary with the same key. This time it just replaces the old value as you know.
At last just save all the dictionary values into your database on backAction or viewWillDisappear method.
This should work for you, if not let me know.
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]
I want to make a grouped TableView similar to the Apple iPhone contacts application.
I need a lot of standard fields which can be edited, but I would only like them editable once the edit button in the navbar is clicked.
This has been bothering me forever that I could not find a good tutorial.
Thanks in advance.
This is not easy. I just built the same thing because there is nothing available from Apple. I ended up creating a single table cell with a UILabel and a UIView on it. The UILabel is for when the cell is in read mode, and the UIView is for editing. The UIView contains a number of UITextFields. These are the individual fields. I also had to implement drawing code to draw the lines between the fields. Then I had to come up with the code to pass in an address object, load it into the fields, format the text for the label, switch in and out of editing mode (with animation), and finally handling saving of changes and canceling. As yet it doesn't handle tapping the address type to select that from a popup list, but I have most of the code in place for the rest.
This could have been done using individual table view cells for each field. But then you can't select the whole thing the way it does in contacts and adding and deleting addresses becomes trickier.
hello i am having table view and in that table view i have put text field on each cell, now how to get the data from the cell , data is in the textfield..
You say it's a custom tableviewcell? How did you make this custom cell? You need to assign an IBOutlet to your textfield and access the text that way (using the 'text' property).
If it's not a custom cell but a standard UITableViewCell then you can get it's text using cell.textLabel.text.
If it's neither of the above then please provide further detail.
maybe you can search on attributes? GetRowCellValue() ?