[ios] Display article name on the nav bar

This commit is contained in:
Alexander Zolotarev 2014-05-11 23:20:02 +08:00
parent b2b43ee530
commit e4218120e5
3 changed files with 6 additions and 4 deletions

View file

@ -7,6 +7,7 @@
@interface ArticleVC : UITableViewController <UISearchBarDelegate, UITableViewDelegate, CLLocationManagerDelegate>
@property (nonatomic, assign) id <ArticleDelegate> delegate;
@property (nonatomic, strong) NSString * currentName;
//uses on start of application
-(NSString *)getDefaultArticle;
-(NSString *)updateView:(NSString *)htmlId;

View file

@ -23,7 +23,6 @@
@property (nonatomic, strong) UISearchBar * searchBar;
@property (nonatomic, strong) CLLocationManager * locationManager;
@property (nonatomic, strong) NSString * currentName;
@property (nonatomic, strong) NSString * currentSubtitle;
@end
@ -181,6 +180,7 @@
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
ArticleInfo const * info = [self infoByIndexPath:indexPath];
NSString * url = [NSString stringWithUTF8String:info->GetUrl().c_str()];
self.currentName = [NSString stringWithUTF8String:info->GetTitle().c_str()];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
[self loadGuideAndPushToNavigationController:url];
[self.delegate selectHtmlPageUrl:url];

View file

@ -72,7 +72,7 @@
UITextAttributeTextColor : [UIColor colorWithRed:253.f/255.f green:241.f/255.f blue:43.f/255.f alpha:1.f],
UITextAttributeTextShadowColor : [UIColor clearColor]
};
self.navigationItem.title = [self getAppName];
[self updateArticleTitle];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
@ -246,6 +246,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
[[self getArticleController] updateView:[htmlId substringFromIndex:slashLocation.location + 1]];
else
[[self getArticleController] updateView:htmlId];
[self updateArticleTitle];
}
}
}
@ -272,9 +273,9 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
return YES;
}
-(NSString *)getAppName
-(void)updateArticleTitle
{
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
self.navigationItem.title = [self getArticleController].currentName;
}
@end