Objects Declared in One Header, unavailable in Another Header and Implmentation
In an iPhone XCODE project, on the left is explorer with classes, objects etc.
I made my app in MainView.h and MainView.m. Design is made in MainWindow.xib.
Now I want to add an accelerometer. I added code in myappViewController.h and .m. but when I want to use some object de开发者_高级运维clared (for example some buttons, views etc) in MainView.h the compiler says they are undeclared. How to move theese declared objects from MainView.h to see them in myappViewController.h ?
The position and groupings of files, frameworks, media etc in the Files and Groups
panel has nothing to do with the location of the items on disk or their inclusion or linkage to other pieces of code. The Files and Groups
panel is purely an organizational convenience for the programmer. The only part that has functional relevance is the target. Items included in a target build show up within the target. Otherwise the organization is arbitrary.
You include objects from one header in another by importing the first header into the second. In you case it would be:
in myappViewController.h
#import "MainView.h"
... now objects defined in MainView.h are known to myappViewController.
精彩评论