How do I hide/show a UITableView programmatically in Objective-C?
I have a UITableView that I have set as hidden by de开发者_如何学Cfault in Interface Builder. I want to set it up so that a user clicks on a button and it shows the UITableView programmatically.
Is there some method I can just call on my UITableView object in order to change its visibility?
myTableView.hidden = NO;
UITableView is a subclass of UIView so inherits all UIView's properties. Look at the documentation for -[UITableView setHidden]
You can also change the alpha on the tableview if you want to fade it in / fade it out. For example:
Fading a view out:
// fade myView out
[UIView animateWithDuration:0.5
animations:^{
myView.alpha = 0;
}];
Fading a view in:
// fade myView in
[UIView animateWithDuration:0.5
animations:^{
myView.alpha = 1;
}];
精彩评论