天蓬老师2017-04-17 17:42:45
I think you have to look at the situation yourself. It is really convenient to use Hidden, but when I used it today, I found that it is not easy to control. It’s not that the logic is difficult to control, but when you add a view to the parent view, If you added it before, then it is below, so you definitely can't click it, so when I need to click on the view above it, it will disappear, but there are buttons on it itself, and it also needs event response, so you can't You can't click on the top, of course you can make it the first layer. Although I haven't tried this, I know that I can use frame to make it on top, but the practical hidden is on the bottom,
This situation is because a BaseViewcontroller is used (inherited ViewCointroller and adds a micro UInavigationViewcontroller to facilitate stacking), other views inherit it, and add response events to the buttons in the navigation bar in BaseViewController. When MoreBtn.hidden == NO, I create MoreView in viewWillAppear, which is this view. OK, what I need is: when clicking MoreBtn, the MoreView will appear with one click. Clicking again will cause the MoreView to disappear. Clicking elsewhere will also cause the MoreView to disappear. I thought it was very simple at first, and I thought it would be fine by using touchBegin, but in fact, I need to click Only the view in the parent view can respond. The current viewController except the navigation bar is a tableView. Don't think that after you inherit the BaseViewcontroller, it will respond wherever you click. You must add a click event to the tableView. Event response. If I use Hidden, it cannot respond. I can only set the frame.
Originally I wanted to find the difference. As soon as I saw the title, I came to discuss it.
============
Sorry, I answered wrongly before. It should not be the cause of the frame. Later I found out that it was the cause of the touch method, because that view also belongs to self.view. Therefore, when you want it to disappear in the touch method, it will disappear when you click it. This is wrong, so I stipulated that the CGpoint used in the click range will disappear when it is included in the navigation bar range. It is really stupid. Method, if there is any other good method, let’s study it. Sorry, it seems that the functions of hidden and frame can actually be the same. Maybe there is something else we need to explore! Come on