Why myView is dealloc after init?
MainViewController:
[MOBubbleView hudWithBody:@"123123" bubblePoint:CGPointMake(220, headerMenu.center.y) hidesAfter:2 show:YES];
MOBubbleView.h:
@interface MOBubbleView : UIViewController
@property (nonatomic, assign) float hudHideDelay;
@property (nonatomic, strong) UIColor *itemColor;
+ (MOBubbleView*)hudWithBody:(NSString*)body bubblePoint:(CGPoint)rect hidesAfter:(float)delay show:(BOOL)show;
@end
MOBubbleView.m:
+ (MOBubbleView*)hudWithBody:(NSString*)body bubblePoint:(CGPoint)point hidesAfter:(float)delay show:(BOOL)show {
MOBubbleView *bubble = [[MOBubbleView alloc] init];
///....
if (show) [bubble addToWindow];
return bubble;
}
- (void)addToWindow {
[[[[UIApplication sharedApplication] delegate] window] addSubview:self.view];
}
- (void)loadView {
CGRect bounds = [[UIScreen mainScreen] bounds];
self.view = [[UIView alloc] initWithFrame:bounds];
[self.view setBackgroundColor:[UIColor clearColor]];
/// .. my animation
}
- (void) dealloc {
NSLog(@"Close myView");
}
@end