开发者

iPhone: can I add Tableview in cell of another tableview?

开发者 https://www.devze.com 2023-03-14 21:57 出处:网络
I have to create a UITableView. Suppose there are 2 table views TableView1 and TableView2. TableView2 will contain suppose 2 text boxes. 开发者_运维技巧And I have to add TableView2 in one cell of Tabl

I have to create a UITableView. Suppose there are 2 table views TableView1 and TableView2. TableView2 will contain suppose 2 text boxes. 开发者_运维技巧And I have to add TableView2 in one cell of TableView1. Finally I have to access the values of text box from the inner TableView2 in the TableView1.

I am new to iPhone development. In short I have to add a tableview to the cell of another tableview. I don't know whether this is possible. If it is, would someone please provide me some link or code to do it.


This is not look good design. You can also use two text field in same cell and make it more in height also make a horizontal separator. also if you have only two textfields then make them global and declared as property.And add in a particular cell.

Read some tutorial for making custom cells and give some time to learning these tutorials. See this link and by googling you can easily find more on this topic.


Yes, you can do. Of course, It is not good practice to do like this. Still you want then here is the trick to do that. Create Two ViewController and inherit them using UITableviewController say ViewController1 and ViewController2. Now in cell of Tableview1 add ViewController2 object. So Tableview2 would in Tableview1's cell. Now you need to handle inner tableview delegate & Datasource in Viewcontroller2. So you don't need to do lots of if.. else in same view controller.

Now you can take two textfield in Viewcontroller2.h file and assign cell's textField to that in cellForrowIndexPath method. So you can access both the textfield any time you want.

I know my answer is bit confusing but ask me any question if you have.

0

精彩评论

暂无评论...
验证码 换一张
取 消