From c1d069b9a419a32b728dac207c69e4b79a8e1b69 Mon Sep 17 00:00:00 2001 From: Kirill Zhdanovich Date: Wed, 7 Aug 2013 15:45:16 +0300 Subject: [PATCH] [iOS] Using SplitController + search button added --- iOS/offlineguides/AppDelegate.mm | 7 +++++-- iOS/offlineguides/ArticleVC.h | 9 ++++++++- iOS/offlineguides/ArticleVC.mm | 6 ++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/iOS/offlineguides/AppDelegate.mm b/iOS/offlineguides/AppDelegate.mm index 2f991e6..1299c69 100644 --- a/iOS/offlineguides/AppDelegate.mm +++ b/iOS/offlineguides/AppDelegate.mm @@ -1,13 +1,16 @@ #import "AppDelegate.h" #import "ArticleVC.h" +#import "IPadSplitVC.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - ArticleVC * table = [[ArticleVC alloc] initWithStyle:UITableViewStylePlain]; - self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:table]; + if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) + self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[ArticleVC alloc] initWithStyle:UITableViewStylePlain]]; + else + self.window.rootViewController = [[IPadSplitVC alloc] init]; [self.window makeKeyAndVisible]; return YES; } diff --git a/iOS/offlineguides/ArticleVC.h b/iOS/offlineguides/ArticleVC.h index 423d859..23c5270 100644 --- a/iOS/offlineguides/ArticleVC.h +++ b/iOS/offlineguides/ArticleVC.h @@ -1,4 +1,11 @@ #import -@interface ArticleVC : UITableViewController +@protocol ArticleDelegate +-(void)selectHtmlPageUrl:(NSString *)url; +@end + +@interface ArticleVC : UITableViewController +@property (nonatomic, assign) id delegate; +//uses on start of application +-(NSString *)getDefaultArticle; @end diff --git a/iOS/offlineguides/ArticleVC.mm b/iOS/offlineguides/ArticleVC.mm index 7179abf..12dfe8a 100644 --- a/iOS/offlineguides/ArticleVC.mm +++ b/iOS/offlineguides/ArticleVC.mm @@ -94,6 +94,7 @@ GuideVC * vc = [[GuideVC alloc] init]; [vc loadPage:[NSString stringWithUTF8String:info->m_url.c_str()]]; [self.navigationController pushViewController:vc animated:YES]; + [self.delegate selectHtmlPageUrl:[NSString stringWithUTF8String:info->m_url.c_str()]]; } - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView @@ -118,4 +119,9 @@ return &m_infos[index]; } +-(NSString *)getDefaultArticle +{ + return [NSString stringWithUTF8String:m_infos[0].m_url.c_str()]; +} + @end