I have multiple prototype cells in a UITableView
. Now in one of these cells, I have a UILabel with top
, 'bottom', leading
and trailing
constraints. I wish to modify the bottom
constraint programmatically. How do I assess this constraint in my code?
I have given identifier
to this constraint in xib
, but when I do lbl.constraints
, I just get the array of following constraints:
po lbl.constraints
<__NSArrayI 0x7f987fb81a60>(
<NSContentSizeLayoutConstraint:0x7f987faca450 H:[UILabel:0x7f98815f4660'Schedule Showing'(117)] Hug:251 CompressionResistance:750>,
<NSContentSizeLayoutConstraint:0x7f987faca4b0 V:[UILabel:0x7f98815f4660'Schedule Showing'(16.5)] Hug:251 CompressionResistance:750>
)
Why is this not showing trailing, leading, bottom and top constraints? Where am I getting wrong? How do I solve this?
Edit(Constraint change not reflected)
-(IBAction)btnShowCtrl_click:(id)sender{
FormTableViewCell *cell = (FormTableViewCell *)[_tblView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:[[dictData valueForKey:@"FeatureList"] count]+4]];
if(cell.nlcTextField.priority == 999){
cell.nlcLabel .priority = 999;
cell.nlcTextField.priority = 500;
} else {
cell.nlcLabel .priority = 500;
cell.nlcTextField.priority = 999;
}
[UIView animateWithDuration:.5 animations:^{
// self.orangeView.alpha = 0;
[_tblView beginUpdates];
[_tblView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:[[dictData valueForKey:@"FeatureList"] count]+4]] withRowAnimation:UITableViewRowAnimationNone];
[_tblView endUpdates];
[cell layoutIfNeeded];
}];
}
@IBOutlet
for the constraint and use that for modification purposes. – Rob@IBOutlet
cannot be created in the .h file of the ViewController. – z22registerclass..
inviewDidLoad
. And incellForRowAtIndexpath
I have used-strIdentifier = @"FormTableViewCell"; FormTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strIdentifier forIndexPath:indexPath];
, the app is crashing, where am I getting wrong. Am not much familiar with usingregisterClass
with multiple prototype cells. – z22