In Xamarin, I want to be able to create a UITableView with the cells to have Text Fields and other controls possibly. How can this be done through the Xcode Interface Builder (or though the Xamarin iOS Designer)?
I would like it to look something like this:
Can someone walk me through doing this?
Bill
This can be achieved through Xcode Interface Builder as follows:
Add UITableView to your view
Type UITableViewCell in the Object Library and drag & drop a "Table View Cell" item to the "Table View" in the View Controller Scene, so that "Table View Cell" is added as a subview for the UITableView. As result, the "Table View Cell" item appears in the storyboard in the table view under the "Prototype Cells" section.
Add any UI elements (labels, text fields, buttons, etc) as subviews for the Table View Cell's Content View.
To have several different cells types, create several prototype cells (i.e. drag & drop one more UITableViewCell onto "Table View").
To distinguish different types of cell prototypes, please enter cell identifiers into Table View Cell's attributes pane.
Set up outlets (UITableView's delegate & data source, outlets for cells' content view's subviews, etc) and actions.
I've attached an Interface Builder's screenshot demonstrating 2 types of cells added to a table view (one with a label and a text field, another with a label and a button).
direct link to a larger image
Related
I am updating my iOS app from table views to collection views to support a "gridded" option.
I have two cell types. One that is more suitable to a "tableView" type look, and takes up the full width of the screen. The other is a cell that is more suitable for grids.
I can't use the same cell type for both because the tableView type cell has a lot more horizontal information than the grid cell.
I have a button press event that will cycle between my cell types, updating the layout and changing the cell reuse identifier appropriately. The problem is, any cells that were already in view do not change to the new cell type. If I scroll for a bit, the new cell types start coming in.
I imagine that this has something to do with the dequeue function for collectionView taking an indexPath. I can explicitly reload those cells to get them to use the new type, but this causes an unwanted animation, not to mention feels like a hack.
How can I switch cell types dynamically?
Linked is a video demonstrating the issue.
https://imgur.com/1Q0Xu9S
As you can see, after I change the cells they remain using the old NIB (with all the extra information). But if I scroll down the new NIB will be used.
There are two solution for this: -
Use two collection view for each type of cell, hide and show respective collection view on click of button.
Remove the collection view from super view on click of button, add again and reload
Originally, the number of menus was one, but it was changed to more than one.
So I want to change the UIView (Container View) so that I can scroll horizontally.
Shop Menu View Cell is TableView -> TableViewCell -> TableViewCell (This) on the screen.
I tried several ways to switch to the horizontal scroll view.
I have separated the Container View and made it into a Cell
I also tried adding Scroll View or UICollectionView.
But all the way was not what I wanted.
Perhaps the Shop Menu View Cell is due to having passed the TableView twice.
I could not solve it for four days.
Please give me a hint how to implement.
To create editable forms of data display for static information, static TableViewController is best choice. As it automatically adjust your view when keyboard appear and other many feature, along with scroll. Plus you can directly outlet all the components to your controller class.
Your view will look something like:
I am trying to design a settings screen. I added a table vc in my storyboard and changed it to static cells. Then I configured the number of sections and the number of cells in each section.
Now I want to add text to each of the table view cells. I tried to select the cell and edit the text property in the property inspector. But I could not find a text property. I then tried to drag a label to the cells' content views. But I can't put the label in exactly the same place as the others. Also this method is very tedious.
I mean there is even a property called textLabel in UITableViewCell class! How can there not be a corresponding property in the interface builder?
How can I do this in IB? Must I use code to set the text of each cell?
Make sure you selected Style: Basic at the Cell's Attribute inspector, and then select the label.
Also, because of the cell has a contentView, the easiest way is to find it in the view hierarchy, or click on the cell until you see the inspector of the label
I am new to iOS programming.
My confusion is on one UIView. I am adding two UITableViews
For second TableView I am using custom TableView Cells. On that TableViewCell I am adding TextFields.
First table Views also I have text fields.
Now On The View I should Use UIScrollView. How can I Handle Scroll View here when I click on all these text Fields.
I have just encountered a problem today that I am unable to add a new table view cell to my UITableview.
What I did was I drag a table view cell and drop inside the UITableview area. The UITableview did not take the table view cell but rather the cell become an individual view of the main view.
Clearly see that table view cell is not included in Table View
So my question is, how to create a custom table view cell in UITableview in an XIB file in Xcode 5?
Thanks in advance!
If you have dynamic prototype cell will be added automatically. If not, you can choose how much cell you want to have in inspector on right side of screen.
And make sure when you put it into screen that is inside of your tableview.
I answer this question thinking you are using storyboard. First add UITableView.
Then you can see as this,
If you want to use static cell, select Table View & in Attributes Inspector , in content select Static Cells. I think for your question you should use Static Cells.