I have simple subclass of UIViewController (code below). If I attach inputAccessoryView, my viewcontroller is never deallocated. If I do not set inputAccessoryView in viewDidLoad, dealloc is called as expected.
Am I missing something?
@interface IMTestViewController : UIViewController
@property (nonatomic, strong) UIView *messageInputView;
@property(nonatomic, readwrite, strong) UIView *inputAccessoryView;
@end
@implementation IMTestViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)dealloc
{
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.inputAccessoryView = self.messageInputView;
}
- (BOOL)canBecomeFirstResponder
{
return YES;
}
- (UIView *)messageInputView
{
if (_messageInputView == nil)
{
_messageInputView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 45)];
_messageInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
}
return _messageInputView;
}
@end
I have ran out of ideas. Thank you.
self.messageInputView
and code used for presentingIMTestViewController
– Tractileself.view
as First Responder instead ofself
. Yes, you need to subclassUIView
orUITableView
and implement some methods. – Ultun