[ios] Fixed memory warning crash when viewing guide article

This commit is contained in:
Alex Zolotarev 2011-04-07 22:02:18 +02:00 committed by Alex Zolotarev
parent 37b8a70625
commit 86afe3e8af
3 changed files with 16 additions and 9 deletions

View file

@ -23,9 +23,9 @@
@property (nonatomic, retain) UINavigationItem * navArticle;
@property (nonatomic, retain) UIPinchGestureRecognizer * pinchGestureRecognizer;
@property (nonatomic, retain) NSString * articleFormat;
@property (nonatomic, assign) UIView * previousView;
@property (nonatomic, assign) UIViewController * parentController;
- (id)initWithPreviousView:(UIView *)previousView;
- (id)initWithParent:(UIViewController *)parentVC;
- (void)setArticleById:(unsigned int)articleId;
@end

View file

@ -15,7 +15,7 @@
@synthesize navArticle;
@synthesize pinchGestureRecognizer;
@synthesize articleFormat;
@synthesize previousView;
@synthesize parentController;
+ (NSURL *)baseURL
{
@ -35,12 +35,12 @@
LOG(LINFO, ("ArticleVC::dealloc done."));
}
- (id)initWithPreviousView:(UIView *)prevView
- (id)initWithParent:(UIViewController *)parentVC
{
if ((self = [super initWithNibName:nil bundle:nil]))
{
self.articleFormat = @"<html><body style='-webkit-text-size-adjust:%d%%'>%@</body></html>";
self.previousView = prevView;
self.parentController = parentVC;
}
return self;
}
@ -148,7 +148,7 @@
[[superView layer] addAnimation:animation forKey:@"SwitchToSearchView"];
[UIView transitionFromView:self.view
toView:self.previousView
toView:self.parentController.view
duration:0
options:UIViewAnimationOptionTransitionNone
completion:nil];

View file

@ -27,6 +27,16 @@ struct SloynikData
@synthesize resultsView;
@synthesize articleVC;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
self.articleVC = [[[ArticleVC alloc] initWithParent:self] autorelease];
}
return self;
}
- (void)dealloc
{
LOG(LINFO, ("SearchVC::dealloc."));
@ -52,8 +62,6 @@ struct SloynikData
m_pSloynikData = new SloynikData;
GetSloynikEngine()->Search("", m_pSloynikData->m_SearchResult);
self.articleVC = [[ArticleVC alloc] initWithPreviousView:self.view];
[self onEmptySearch];
}
@ -71,7 +79,6 @@ struct SloynikData
// e.g. self.myOutlet = nil;
self.searchBar = nil;
self.resultsView = nil;
self.articleVC = nil;
}
- (void)searchBar:(UISearchBar *)sender textDidChange:(NSString *)searchText