Fixed BUG details in iOS development and bug details in ios development

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.