Fixed BUG details in iOS development and bug details in ios development
In this blog, I will occasionally update some of my bugs in details and provide solutions. For more information, see.
1. tableHeaderView of tableView
Please note that I am talking about tableHeaderView, not selection. My specific situation is: first, alloc A UIView, And it is specified as tableView tableHeaderView. Then the adaptive height is implemented, causing the frame of tableHeaderView to change. At this time, I found that the cell is overwritten by tableHeaderView. In this case, after the frame is changed, you can solve the problem by re-specifying the UIView object as tableview tableHeaderView.
2. Question about loading a subview for the parent view.
Before talking about this question, let me talk about a small detail. ViewDidLoad is executed before viewpaiappear.
The problem I encountered was that I needed to get a value from the parent control and pass it to the subcontroller. This is a very simple problem. I wrote the original code as follows:
LoadWebController *webVC = [[LoadWebController alloc] init]; [self addChildViewController:webVC]; webVC.view.frame = CGRectMake(hScreenWidth, 0, hScreenWidth, self.rootScrollView.frame.size.height); [self.rootScrollView addSubview:webVC.view]; webVC.model = self.model;
During running, I found that when viewDidLoad uses the model value, the value is empty. This is the code execution sequence I mentioned above. The above method is used to pass the value in viewpaiappear, which leads to no value transfer during viewDidLoad execution.
The solution is also very simple.
webVC.model = self.model;
Put in
LoadWebController *webVC = [[LoadWebController alloc] init];
. This statement is followed by viewDidLoad. Viewpaiappear is in
[self.rootScrollView addSubview:webVC.view];
It will be executed later.