I am getting confuse weither reference to subviews i am creating in a view should be declared with the weak or strong keyword when using ARC in iOS5.
Here is a sample of my header file:
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@class SCLGridView;
@interface MyViewController : UIViewController <UIPopoverControllerDelegate, MFMailComposeViewControllerDelegate>
@property (weak, nonatomic) IBOutlet UIView *hiddenBrowserView;
@property (strong, nonatomic) SCLGridView *gridView;
@property (strong, nonatomic) UIImageView *backgroundView;
@property (strong, nonatomic) UIView *backgroundShadowView;
@property (strong, nonatomic) UIPopoverController* popOverController;
@end
I run under the impression that the views i am creating and want to reference should be declare with the strong keyword because i am owning those views(i create them). However i have declared the hiddenBrowserView as weak because i am referencing a view i have created in the storyboard. Is this apporach correct or i should make all those view reference as weak even for the reference to views i create programmatically? Thanks!
As far as I know the subviews are strongly referenced by the main view of your controller. So there is no purpose of referencing them strong because the’ll be useless when your main view goes down.