viewWillAppear is called on UIViewController when a view is about to be shown on screen. Is it possible to get similar callback on UIView?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
Macro Solution
I've made a macro solution for this that is very elegant and easy to use.
.m
Add the following to your .m
Yup! It really is that easy!
(Due to how the ifdef toggling of the macro is set-up below, you can use one or the other or both!)
.h
Add the following to your .h beneath
@end
(or, if you want to keep things clean, you can simply add to a file called macros.h and #import it)Note: If you add this (or import this) to multiple files that also import each other or @class each other you can end up messing up the #ifdef logic and this macro could fail, I suggest importing it from a separate .h file for each class you need it in, this macro was created more as a proof of concept than something to be used in production code
How about the following from the UIView reference
this will at least tell you when it is added to a view hierarchy but there is no guarantee that the view hierarchy is presented/viewable.
No, but you can forward that notification to the desired view from your view controller.