I have table view in which I want my Image view to reset the frame
I used the following code:
[[cell imageView] setFrame:CGRectMake(0,0,32,32)];
But nothing is working
Please let me know how to resize the default imageView section
Thanks
The best way is to add - (void)layoutSubviews
to your cell subclass like this:
- (void)layoutSubviews {
[super layoutSubviews];
self.imageView.frame = CGRectMake(0.0f , 0.0f, 32.0f, 32.0f);
}
UITableViewCell
have a fixed layout, depending on the style you use when you initialize it. You cannot change that layout, since the cell lays out its subviews as it prefers to have them.
If you want to use another layout, you'll have to make your own cell and use that. Quoting the documentation of UITableViewCell
:
If you want a table cell that has a configuration different that those defined by UITableViewCell for style, you must create your own custom celle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With