简体   繁体   中英

Custom class with prefix not showing up in custom class combo box in Interface Builder

If I create a custom class called MTViewController that is derived from UIViewController, I can't select it in the custom class combo box in Interface Builder in XCode 4.5. Anybody know why?

I think it's a bug of Interface builder. And also it's not related with UIViewController or MTViewController. For some reason it doesn't show some of the newly added class names over there but if you type it yourself and run the application you don't get any errors.

Moreover you can try this, after creating a class just close the project and open it again . If you go to identitiy inspector this time you will see the class name there. SO in my opinion it is a bug in XCode.

Thanks

you can try any of these steps.

  1. Make sure it inherits UIViewController. @interface MTViewController : UIViewController
  2. Under target check in build phase if MTViewController.m is present
  3. Delete the UIViewController UI object and put it back again and check if its appears back in custom class

  4. Just to reset it close your project and open it back again.

Ok, I just upgraded my iMac and Macbook to Xcode 6.3. On my iMac everything was rosey with my project but on my Macbook I could not get any of my custom view controllers to appear in the custom class field of the file owner of any of my xibs. Even creating a new project still wouldn't work. I knew it wasn't a problem with my project because it worked on my iMac.

So after hours of trying different solutions and tweaks the only thing that worked was uninstalling Xcode 6.3 and re-installing it. I believe this problem came out of the something getting out of sync as I have upgraded through multiple versions of Xcode over the years.

Save yourself the headaches for anyone reading this and start with a clean version of Xcode if you get this problem.

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