简体   繁体   中英

Adding a View controller NIB to another View controller

I have a progress bar in a view controller which I have to use in two different View controllers (screens). When an upload action is going on, the progress bar VC has to be active in both the screens (two diff VC). Now when I am running the upload, the upload is going on in the back but the NIB has not been loaded in the two screens. The scenario is that I am not allocating memory for the Upload Progress bar VC in the appdelegate but instead am doing that in one of the screens. This way, I am not able to allocate memory globally and if I am doing so by putting it in the appdelegate, my NIB is not read and does not appear in any of the screens. Any suggestions as to why this behavior is seen? I have allocated memory and also used addSubview method to include the VC in the needed screen.

Hope someone could solve my issue. Thanks a lot!

I think this is not possible using only one progress bar. If you add it to a view and then add it to another view, I think instead of being added to both views it's only added to the second view. I think for your code to work you should have two progress bars, one for each screen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM