How to adjust the height of a table view programmatically in viewdidload
How can I automatically adjust the height of the table in the viewdidload? in fact, I have a view in my application. I want this view to be loaded, then uivew will hide the table height, will it increase? How can I do that? I added these lines to viewdidload but nothing happens?
- (void)viewDidLoad {
[super viewDidLoad];
CGRect tableFrame = [tableListView frame];
tableFrame.size.height = 127;
[tableListView setFrame:tableFrame];
}
Below is my screenshot I want to hide this greycolourview and want to increase my table height.
source to share
Take a picture:
1.
This should be your restrictions on tableView
:
2.
//declare a constraint outlet and connect it
IBOutlet NSLayoutConstraint *constraintGrayViewBottom;
3.
This is the lower limit of the gray species ie The: constraintGrayViewBottom
.
Select the bottom constraint as shown in the picture and on the right, drag the link to connect to the viewController and connect it to constraintGrayViewBottom
.
4.
Process constraint changes as an example:
-(void)viewDidAppear:(BOOL)animated {
constraintGrayViewBottom.constant = -60;
[UIView animateWithDuration:1
animations:^{
[self.view layoutIfNeeded];
}];
}
source to share