I am making two tableview cell in one controller class on vertical style. I have different value both the cell. Left cell have some name value for eg(name :pradeep),and right side cell have some price value so if select on left cell on 3row and right side cell on 2 row so this two cell value I have to pass for open url.
Please help on this how to know which cell index are selected from both the tableview cell and what the value on that selected cell.
If I understand your requirements correctly then you should probably be using a UIPickerView:
http://www.youtube.com/watch?v=wnxS35JDqok
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPickerView_Class/Reference/UIPickerView.html
You can add multiple tableview cell. You need to separate or identify them using Identifier. After creating custom cell, you can add tableview cell into Cellforrowatindex path method.Make sure don't forgot to import "custom cell.h" in your implementation file. Thanks.
Related
I trying to make my app accessible, in my interface I have a UILabel and a UITableView, the tableView have a selectedRow. The selectedRow is the row in the middle of table view, for example is the row 50 if I have 100 row.
My problem is when I swype in screen to go to my next element, in this case when I go from label to tableView, the focus go to the first index and not to my cell was selected.
How I can fix that?
Assuming you have only a label and a table view, the problem boils down to keep in mind the latest position of the cell when you move from the label to the table view.
The following algorithm may be used to solve this problem :
Create a temporary index path variable (tmpIP) containing the index path of the selected cell.
When the label loses the focus, the table view selects the cell with the latest tmpIP index path. The variable value is nil if no cell was selected before the label selection.
Take a look at the UIAccessibilityFocus informal protocol to handle the focus of an accessible element.
I need to add a subview to TableViewCell when the button in TableViewCell is clicked it should show another tableview as a subview and height of the tableview should be dynamic according to number of cell.
How can I do this?
Above screenshot is taken from a very popular shopping app and I need to do the same in my project.
You can easily achieve this using simple UITableView. For that you need to set all your main categories as your UITableview section and respected sub-categories can be added to respective rowOfSection.
You can use just one table view with UITableViewStyleGrouped style, and set "Men","Women","Kids & Baby" as TableView sections header, keep an boolean value to determine the result of "numberOfRowsInSection:" of each section and reload tableview.
See the below link at github:
https://github.com/OliverLetterer/SLExpandableTableView
This contains the Expandable TableView, which you required. You have to implement SLExpandableTableViewDelegate and SLExpandableTableViewDatasource which contains different method, in which you have to provide inner tableview as well.
Hope this helps you.
You need to do some work on your own I can give the directions that'll give you a way from my point of view :-
Make a Custom cell which you want to expand.
While designing the cell make its height in storyboard like 200 or so according to your need and add all the elements those you want to see when the cell is expanded.
You'll need two delegate methods first -didSelectItemAtIndexPath and second HeightForRowAtIndexPath at index path.
First You need to make sure the user taps on the button or cell that you want to expand , and to achieve that you need to call didSelectItemAtIndexPath.
Once you get your cell Position, in HeightForRowAtIndexPath check the indexpath is equal to your cell's indexpath,if yes then return the exact height(ie:200) of your cell otherwise return the default(ie:70) height of you cell.
Note : In didSelectItemAtIndexPath you need to call to method to update the current cell
[self.tableView beginUpdates];
[self.tableView endUpdates];
As the title says, i'm trying to put one UITableView inside a custom UICollectionViewCell, i made it so it's perfectly displayed, but now i need the touches inside the Cell that contains the Table to call the didSelectRowForIndexPath method.
I have a .xib for this custom UICollectionViewCell, inside it i have the UITableView, and i have it's delegate and datasource correctly set.
Now, if i run this, the CollectionView cells are loaded with their proper data (this is, each cell with a table containing the proper rows), but if i try to select one row from one table, the CollectionViewCell is selected instead of the TableViewCell (this is expected, but not what i need).
I'd like to know if is there a way for the TableView row to get selected, even if it's inside a CollectionView cell.
Thank you and sorry for my english.
Hi, I am new to iOS and i am trying to have two text fields inside a custom table view cell and the cells are dynamic, so I will be having two text fields in each cell and when a cell is selected the cell will expand
How can I reposition the text field when the cell expands? One text field should be on the top and the other one on the bottom inside the tableview cell.
How can i access the uitext field delegate inside uitable view delegate
i.e.:
textFieldShouldBeginEditing inside tableView:didDeselectRowAtIndexPath:indexPath
Thanks in advance
I would suggest having two different custom UITableViewCells - one for viewing and one for editing. When didSelectRowAtIndexPath is called, replace the selected cell with the second custom cell designed for editing. When the user is finished, replace it again with the original custom cell type.
For your second question about accessing subviews of the UITableViewCell, you have several options. I'm going to assume you're using storyboards.
If you created a custom class for your UITableViewCells, you can add the UITextView as a class property and connect it as a outlet from your storyboard to your class by making it an IBOutlet. That way you can access it via self.nameOfTextView.
If you don't want to create a custom class for your UITableViewCells, you can assign the subviews tags and access them via (UITextView *)[cell.contentView viewWithTag:1]. This second option can also be used if you aren't using storyboards.
UITableView returns the same callback "didSelectRowAtIndexPath" with the same NSIndexPath (0,0) both for section click and section first row click. I'm using custom view for section header view and I need to perform some action on these section rows. Tried checking cell class with [tableView cellForRowAtIndexPath:indexPath] but it's obviously returning the same row cell instead of section cell. Any suggestions?
UPDATE I could add my custom section view to first row instead of adding it as a section, however in that case, I would need to return different row height in "heightForRowAtIndexPath" and that would be not-performanc-wise decision.
UPDATE I'v designed my section view as a subclass of UITableViewCell, because I prefer to get native UITableView callbacks instead of workaround'ing with tap gestures or buttons.
Centurion, if you want to have section that you open/close easily, I suggest you to use the class APLSectionHeaderView.
You can find more information on APLSectionHeaderView.h and APLSectionHeaderView.m
Hope it will help you.
I've been using it, so if you have some question about it...