Why can't I set - [UITableView alwaysBounceVertical] with IB?

I have a UITableView that I don't want to bounce when there are not enough cells in the table to guarantee scrolling. So I set -bounces to YES and -alwaysBounceVertical to NO.

I am trying to set these properties using IB using the "Bounces" and "Bounce Vertically" checkboxes, but it seems that no matter what I set for the Bounce Vertically property in IB, it is always YES at runtime.

I would rather be able to fully configure this using IB and not require setting the property using code. Does anyone know why this is not working?

+4
source share
3 answers

Checking "Bounces Vertically" in the Builder interface seems broken. However, I found that you can set alwaysBounceVertical as the "Custom Runtime attribute" in IB, and it really works.

(Xcode 5.0.1 SDK for iOS7)

+4
source

You cannot do what you want in the interface builder. Rather, you need to implement this simple code to accomplish the required task.

You need to set the "Bounces" property to NO instead of YES and "Bounce Vertically" - "YES" in the interface builder. To enable bounce when there are more cells, you can use this code:

  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSInteger iRows = [arraytableData count]; if(tableView.visibleCells.count < iRows) { tableView.bounces = YES; } else { tableView.bounces = NO; } return iRows; } 
+1
source

I have the same problem while loading a page, it always bounces vertically to a UITableView. After a long search, I got a solution. I create a custom navigation bar using an image in Xib and put the UITableView in front of the UIImageView in the UIView placeholders. Then I changed the position of the UITableView in the UIView placeholders, and below the code works for me self.tableView.alwaysBounceVertical = NO;
If anyone has this type of problem, please double check the position of the UITableView in placeholders. Thanks

0
source

Source: https://habr.com/ru/post/1446370/


All Articles