I know that no one will take the initiative to set up this thing, but everyone must have encountered this problem, the following summary of what may be the situation:
1, self.automaticallyadjustsscrollviewinsets = NO; This should be the most common and not easy to find cause, the cause is iOS7 in Conttoller new automaticallyadjustsscrollviewinsets This property, when set to Yes (default Yes), If the view contains a unique Uiscrollview or its subclass view, it automatically sets the padding, which allows scroll to occupy the entire view without obscuring the navigation bar.
Ps:ios7 inside the layout problem is a lot of, use AutoLayout time will encounter a lot, probably because iOS7 new join AutoLayout still immature led to it.
2,navigationbar Setup Issues Although there is a blank at the top of the tableview on the surface, it may actually be caused by Navigationbar setup problems.
Self.navigationController.navigationBar.translucent = NO; After this attribute is set to No, the TableView will leave a position of 64.f above the Navigationbar, and there is a small probability that this problem is caused.
3,tableview section Header Height setting problem This should be a novice encounter more. The cause is the logic of the iOS miracle, and if you set the header (or footer) height to 0, the system will think you're not set and set it to 40.F. So you need to set it to a smaller number:
-(CGFloat) TableView: (UITableView *) TableView heightforheaderinsection: (nsinteger) Section { return 0.001f; }
4,tableview header, footer setup issues It's like 3, isn't it? Don't you see the difference? Let's read it again. This is caused by the header view of the TableView, not the header height of the section.
For TableView, not only each section has Header,tableview as a whole there are also headers and Footer,api as follows:
@property (Nonatomic, Strong, nullable) UIView *tableheaderview; Accessory view for above row content. Default is nil. Not to is confused with section header @property (Nonatomic, Strong, nullable) UIView *tablefooterview; Accessory View below content. Default is nil. Not to is confused with section footer This header and footer to be more harmonious than the section header, as long as you do not take the initiative to touch it is OK, but if you touch ... Hum, hum ... Will basically be set to 40.f high spacing. This problem can occur if any of the following lines of code are present:
Self.tableView.tableHeaderView = nil;
Self.tableView.tableHeaderView = [[UIView alloc] init];
Self.tableView.tableHeaderView = [[UIView alloc] Initwithframe:cgrectzero];
Self.tableView.tableFooterView = nil;
Self.tableView.tableFooterView = [[UIView alloc] init];
Self.tableView.tableFooterView = [[UIView alloc] Initwithframe:cgrectzero];
Yes, you do not think wrong, Footerview can not set, footer and header as long as the set of any one will make two places will appear blank. Don't ask me why ...
Of course, what if you really only need one view at a time? Please set the following: (not like silly, build a view Bai, have to use the disgusting things ...) )
Self.tableView.tableHeaderView = [[UIView alloc] Initwithframe:cgrectmake (0, 0, Kscreensize.width, 0.0001f)]; Self.tableView.tableFooterView = [[UIView alloc] Initwithframe:cgrectmake (0, 0, Kscreensize.width, 0.0001f)]; Plainly, it has to be set to a very small height, not 0.
TableView on the top of the summary of the basic of these, if you want to block, it is recommended to write these in Basetableviewcontroller, so that you do not have to buckle these things every time. Macro lazy sticky, are common, we should all be able to understand. Navigationbar that, because this thing is not usually set here, it is not a good practice to write in base. |