0
votes

enter image description here

I have Implemented tableview named as mytableview inside UIView in UITableviewController named as maintablevew,and also I dynamically increased mytableview height based on cells count.it getting Increased Dynamically,Here my problem is when mytableview height getting increased I can't scroll upto bottom because I can't increased UIView height Dynamically,I don't know how to increase,can anyone suggest? Below code I used to increase mytableview height Dynamically.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    CGFloat numberOfRows =roomlabel.count;

    CGRect tableViewFrame = tableView.frame;
    tableViewFrame.size.height = numberOfRows * _mytableview.rowHeight;
    _mytableview.frame = tableViewFrame;

    return numberOfRows;
}
1
add a height constraint to your view, create a IBOutlet to height constraint and finally update the constraint's constant value to numberOfRows * _mytableview.rowHeight; finally call layoutIfNeeded on your view to reflect constraint value change - Sandeep Bhandari
ok let I check and where would I call layoutIfNeeded method ....can send the sample code for this issues. - Shubam Gupta
Share your requirement screen shot. Because if you set the frame(with all cells heights) to UITableView, then all cells are think they are in visible state. Then how can they scroll?. So embedded your table view in inside scroll view. - phani
I uploaded my screenload...Bottom i have a cell, but I can't able to scroll - Shubam Gupta
Is that UIView subview of Cell in UITableViewController , where you have added the myTableView? - Arun Kumar

1 Answers

0
votes

You don't need to increase(change) the height of the UITableView or UIView, You just have to provide cell height, It will automatically update it's content size, and table will become scrollable.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
CGFloat numberOfRows =roomlabel.count;
return numberOfRows; }