I have just inherited a code base and the project seems to be made up mainly of UIViews.
Here is an example of a header file for a UIView which was written on 29/07/2014, so the code is relatively new:
#import <UIKit/UIKit.h>
@interface SettingsView : UIView {
UIView *aView;
UIViewController *controller;
}
@property(nonatomic,strong)UIView * aView;
@property(nonatomic,strong)UIViewController * controller;
@end
You can see that there is a pointer to a UIViewController. In the implementation file, the mainView is used in a few places. Here is an example:
MyView *myView = [[MyView alloc] initWithFrame:CGRectMake(0, yPos, scroller.frame.size.width, 50)];
myView = 102;
myView = mainView; // Here we are setting another view with this controller.
[scroller myView];
To me this code doesn't feel right. However I would like to know if there is a good reason someone would have a pointer from a UIView to a UIViewController. I have seen my fair share of iOS code over the years and this is the first time I have seen this.
Any insights would be much appreciated.