From 135cb84e76e58c64e1b9953f16e3544f1b2db3a2 Mon Sep 17 00:00:00 2001 From: siqi Date: Fri, 12 Jul 2013 16:21:42 +0200 Subject: iOS5 backward compatible Change-Id: Ia540e68d953069e5f690a36303823f59e1129b46 --- ios/iosremote/iosremote.xcodeproj/project.pbxproj | 24 ++---- .../UserInterfaceState.xcuserstate | Bin 70600 -> 72710 bytes .../xcdebugger/Breakpoints.xcbkptlist | 25 ++---- ios/iosremote/iosremote/AppDelegate.h | 2 +- ios/iosremote/iosremote/AppDelegate.m | 18 +++++ .../en.lproj/iPhone_autolayout.storyboard | 88 +++++++++++---------- ios/iosremote/iosremote/iosremote-Info.plist | 2 +- ios/iosremote/iosremote/slideShowPreviewTable_vc.m | 8 +- ios/iosremote/iosremote/slideShowSwipeInList.m | 25 ++++-- 9 files changed, 105 insertions(+), 87 deletions(-) (limited to 'ios') diff --git a/ios/iosremote/iosremote.xcodeproj/project.pbxproj b/ios/iosremote/iosremote.xcodeproj/project.pbxproj index 7b8bddecffe7..32c9b87b6d8e 100644 --- a/ios/iosremote/iosremote.xcodeproj/project.pbxproj +++ b/ios/iosremote/iosremote.xcodeproj/project.pbxproj @@ -36,7 +36,6 @@ 57C6E405175E06E800E8BC5F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E404175E06E800E8BC5F /* Default.png */; }; 57C6E407175E06E800E8BC5F /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E406175E06E800E8BC5F /* Default@2x.png */; }; 57C6E409175E06E800E8BC5F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E408175E06E800E8BC5F /* Default-568h@2x.png */; }; - 57C6E40C175E06E800E8BC5F /* iPhone_autolayout.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E40A175E06E800E8BC5F /* iPhone_autolayout.storyboard */; }; 57C6E42E175E076900E8BC5F /* Client.m in Sources */ = {isa = PBXBuildFile; fileRef = 57C6E427175E076900E8BC5F /* Client.m */; }; 57C6E42F175E076900E8BC5F /* CommunicationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 57C6E429175E076900E8BC5F /* CommunicationManager.m */; }; 57C6E430175E076900E8BC5F /* CommandInterpreter.m in Sources */ = {isa = PBXBuildFile; fileRef = 57C6E42B175E076900E8BC5F /* CommandInterpreter.m */; }; @@ -49,7 +48,7 @@ 57DC7007178D84490050FC58 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57DC7006178D84490050FC58 /* CoreMotion.framework */; }; 57DC700F178E03330050FC58 /* touchPointer_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57DC700E178E03330050FC58 /* touchPointer_vc.m */; }; 57DC7012178E16A40050FC58 /* setRecursiveUserInteraction.m in Sources */ = {isa = PBXBuildFile; fileRef = 57DC7011178E16A40050FC58 /* setRecursiveUserInteraction.m */; }; - 57DF0A85178FFFAB008B2D3D /* iPhone_spring&strut.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57DF0A83178FFFAB008B2D3D /* iPhone_spring&strut.storyboard */; }; + 57DF0A85178FFFAB008B2D3D /* iPhone_autosize.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57DF0A83178FFFAB008B2D3D /* iPhone_autosize.storyboard */; }; 57FE71E31785C61400B50125 /* pinValidation_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E21785C61400B50125 /* pinValidation_vc.m */; }; 57FE71E61785D7FE00B50125 /* slideShowPreview_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E51785D7FE00B50125 /* slideShowPreview_vc.m */; }; 57FE71E917861A9000B50125 /* slideShowPreviewTable_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E817861A9000B50125 /* slideShowPreviewTable_vc.m */; }; @@ -99,7 +98,6 @@ 57C6E404175E06E800E8BC5F /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 57C6E406175E06E800E8BC5F /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 57C6E408175E06E800E8BC5F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - 57C6E40B175E06E800E8BC5F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/iPhone_autolayout.storyboard; sourceTree = ""; }; 57C6E426175E076900E8BC5F /* Client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Client.h; sourceTree = ""; }; 57C6E427175E076900E8BC5F /* Client.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Client.m; sourceTree = ""; }; 57C6E428175E076900E8BC5F /* CommunicationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CommunicationManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -119,7 +117,7 @@ 57DC700E178E03330050FC58 /* touchPointer_vc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = touchPointer_vc.m; sourceTree = ""; }; 57DC7010178E16A40050FC58 /* setRecursiveUserInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setRecursiveUserInteraction.h; sourceTree = ""; }; 57DC7011178E16A40050FC58 /* setRecursiveUserInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = setRecursiveUserInteraction.m; sourceTree = ""; }; - 57DF0A84178FFFAB008B2D3D /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = "en.lproj/iPhone_spring&strut.storyboard"; sourceTree = ""; }; + 57DF0A84178FFFAB008B2D3D /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/iPhone_autoSize.storyboard; sourceTree = ""; }; 57FE71E11785C61300B50125 /* pinValidation_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pinValidation_vc.h; path = Communication/pinValidation_vc.h; sourceTree = ""; }; 57FE71E21785C61400B50125 /* pinValidation_vc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = pinValidation_vc.m; path = Communication/pinValidation_vc.m; sourceTree = ""; }; 57FE71E41785D7FE00B50125 /* slideShowPreview_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slideShowPreview_vc.h; sourceTree = ""; }; @@ -296,8 +294,7 @@ 57DF0A78178FFF8C008B2D3D /* StoryBoards */ = { isa = PBXGroup; children = ( - 57DF0A83178FFFAB008B2D3D /* iPhone_spring&strut.storyboard */, - 57C6E40A175E06E800E8BC5F /* iPhone_autolayout.storyboard */, + 57DF0A83178FFFAB008B2D3D /* iPhone_autosize.storyboard */, ); name = StoryBoards; sourceTree = ""; @@ -358,7 +355,6 @@ 57C6E405175E06E800E8BC5F /* Default.png in Resources */, 57C6E407175E06E800E8BC5F /* Default@2x.png in Resources */, 57C6E409175E06E800E8BC5F /* Default-568h@2x.png in Resources */, - 57C6E40C175E06E800E8BC5F /* iPhone_autolayout.storyboard in Resources */, 57867A541787172A00EBBE52 /* impress.jpeg in Resources */, 57867A5A1787510700EBBE52 /* pushed_next_button.png in Resources */, 57867A5B1787510700EBBE52 /* released_next_button.png in Resources */, @@ -374,7 +370,7 @@ 57CC48C7178B42A400075DE4 /* timer_resume_btn.png in Resources */, 57DC7003178D82610050FC58 /* ic_launcher.png in Resources */, 57DC7005178D82940050FC58 /* ic_launcher@2x.png in Resources */, - 57DF0A85178FFFAB008B2D3D /* iPhone_spring&strut.storyboard in Resources */, + 57DF0A85178FFFAB008B2D3D /* iPhone_autosize.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -420,20 +416,12 @@ name = InfoPlist.strings; sourceTree = ""; }; - 57C6E40A175E06E800E8BC5F /* iPhone_autolayout.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 57C6E40B175E06E800E8BC5F /* en */, - ); - name = iPhone_autolayout.storyboard; - sourceTree = ""; - }; - 57DF0A83178FFFAB008B2D3D /* iPhone_spring&strut.storyboard */ = { + 57DF0A83178FFFAB008B2D3D /* iPhone_autosize.storyboard */ = { isa = PBXVariantGroup; children = ( 57DF0A84178FFFAB008B2D3D /* en */, ); - name = "iPhone_spring&strut.storyboard"; + name = iPhone_autosize.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ diff --git a/ios/iosremote/iosremote.xcodeproj/project.xcworkspace/xcuserdata/siqi.xcuserdatad/UserInterfaceState.xcuserstate b/ios/iosremote/iosremote.xcodeproj/project.xcworkspace/xcuserdata/siqi.xcuserdatad/UserInterfaceState.xcuserstate index 931853b20a8f..ea2ca0dbb6e3 100644 Binary files a/ios/iosremote/iosremote.xcodeproj/project.xcworkspace/xcuserdata/siqi.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/iosremote/iosremote.xcodeproj/project.xcworkspace/xcuserdata/siqi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ios/iosremote/iosremote.xcodeproj/xcuserdata/siqi.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ios/iosremote/iosremote.xcodeproj/xcuserdata/siqi.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist index e0c2aef646eb..f488c43b9e92 100644 --- a/ios/iosremote/iosremote.xcodeproj/xcuserdata/siqi.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist +++ b/ios/iosremote/iosremote.xcodeproj/xcuserdata/siqi.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -17,29 +17,16 @@ landmarkType = "3"> - - diff --git a/ios/iosremote/iosremote/AppDelegate.h b/ios/iosremote/iosremote/AppDelegate.h index 6e61ec1fa0eb..5a1573434a75 100644 --- a/ios/iosremote/iosremote/AppDelegate.h +++ b/ios/iosremote/iosremote/AppDelegate.h @@ -12,11 +12,11 @@ @class ViewController; @interface AppDelegate : UIResponder { + // make sure we instanciate only once motionManager CMMotionManager *motionManager; } @property (readonly) CMMotionManager *motionManager; @property (strong, nonatomic) UIWindow *window; -@property (strong, nonatomic) ViewController *viewController; @end diff --git a/ios/iosremote/iosremote/AppDelegate.m b/ios/iosremote/iosremote/AppDelegate.m index b548d69ade9e..5d3223ce2ab6 100644 --- a/ios/iosremote/iosremote/AppDelegate.m +++ b/ios/iosremote/iosremote/AppDelegate.m @@ -10,9 +10,27 @@ @implementation AppDelegate +@synthesize window = _window; + - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. + /** + * If ever we need some iOS6-only storyboard based features and we want to keep backward compatibility, we should uncomment these code to pick the right storyboard based on the existence on certains classes. + */ +// UIStoryboard *mainStoryboard = nil; +// if (NSClassFromString(@"NSLayoutConstraint")) { +// mainStoryboard = [UIStoryboard storyboardWithName:@"iPhone_autolayout" bundle:nil]; +// NSLog(@"loading autolayout storyboard"); +// } else { +// mainStoryboard = [UIStoryboard storyboardWithName:@"iPhone_autosize" bundle:nil]; +// NSLog(@"Doesn't support autolayout, loading autosize"); +// } +// +// self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; +// self.window.rootViewController = [mainStoryboard instantiateInitialViewController]; +// [self.window makeKeyAndVisible]; + return YES; } diff --git a/ios/iosremote/iosremote/en.lproj/iPhone_autolayout.storyboard b/ios/iosremote/iosremote/en.lproj/iPhone_autolayout.storyboard index 850d83faab3c..8cd6d614b694 100644 --- a/ios/iosremote/iosremote/en.lproj/iPhone_autolayout.storyboard +++ b/ios/iosremote/iosremote/en.lproj/iPhone_autolayout.storyboard @@ -723,58 +723,63 @@ - - - + - - - - - - - - - - - - - + + + + + - @@ -838,6 +843,7 @@ + diff --git a/ios/iosremote/iosremote/iosremote-Info.plist b/ios/iosremote/iosremote/iosremote-Info.plist index cb575a0ef2b6..578325c61939 100644 --- a/ios/iosremote/iosremote/iosremote-Info.plist +++ b/ios/iosremote/iosremote/iosremote-Info.plist @@ -38,7 +38,7 @@ LSRequiresIPhoneOS UIMainStoryboardFile - iPhone_autolayout + iPhone_autoSize UIPrerenderedIcon UIRequiredDeviceCapabilities diff --git a/ios/iosremote/iosremote/slideShowPreviewTable_vc.m b/ios/iosremote/iosremote/slideShowPreviewTable_vc.m index 5086ef3b239a..c2b7dc1aac4d 100644 --- a/ios/iosremote/iosremote/slideShowPreviewTable_vc.m +++ b/ios/iosremote/iosremote/slideShowPreviewTable_vc.m @@ -63,14 +63,18 @@ { if (self.slidesRunning && [self.comManager.interpreter.slideShow size] > 0){ self.slidesRunning = NO; - [self.parentViewController performSegueWithIdentifier:@"slideShowSegue" sender:self]; + [self performSegueWithIdentifier:@"slideShowSegue" sender:self]; } NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; self.slideShowStartObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_CONNECTED_SLIDESHOW_RUNNING object:nil queue:mainQueue usingBlock:^(NSNotification *note) { - [self.parentViewController performSegueWithIdentifier:@"slideShowSegue" sender:self]; +// if (NSClassFromString(@"NSLayoutConstraint")) +// // support autolayout, this tablevc has a parent_vc which has this segue +// [self.parentViewController performSegueWithIdentifier:@"slideShowSegue" sender:self]; +// else + [self performSegueWithIdentifier:@"slideShowSegue" sender:self]; }]; [super viewDidAppear:animated]; } diff --git a/ios/iosremote/iosremote/slideShowSwipeInList.m b/ios/iosremote/iosremote/slideShowSwipeInList.m index 011fccc6b23d..76a3a68d796e 100644 --- a/ios/iosremote/iosremote/slideShowSwipeInList.m +++ b/ios/iosremote/iosremote/slideShowSwipeInList.m @@ -52,11 +52,11 @@ dispatch_queue_t backgroundQueue; - (void) viewDidAppear:(BOOL)animated { [self changeStartButtonIconForButton:nil]; - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.slideshow.currentSlide + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.slideshow.currentSlide inSection:1]; [self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO]; - [[[self.tableView cellForRowAtIndexPath:indexPath] viewWithTag:2] setBackgroundColor:[UIColor lightGrayColor]]; +// [[[self.tableView cellForRowAtIndexPath:indexPath] viewWithTag:2] setBackgroundColor:[UIColor lightGrayColor]]; } - (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender @@ -114,6 +114,11 @@ dispatch_queue_t backgroundQueue; return nil; } +- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath +{ + [self performSegueWithIdentifier: @"sw_customized_segue" sender: [tableView cellForRowAtIndexPath: indexPath]]; +} + - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { @@ -137,6 +142,16 @@ dispatch_queue_t backgroundQueue; } } +- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ + // Otherwise selection will disable background color and make slide number unreadable + if(indexPath.section == 1 && cell.selected){ + UILabel *label = (UILabel *)[cell viewWithTag:2]; + if ([label backgroundColor]!=[UIColor lightGrayColor]) { + [label setBackgroundColor:[UIColor lightGrayColor]]; + } + } +} + - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) @@ -165,7 +180,7 @@ dispatch_queue_t backgroundQueue; // Format the elapsed time and set it to the label NSString *timeString = [dateFormatter stringFromDate:timerDate]; - UILabel *l = (UILabel *)[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]] viewWithTag:1]; + UILabel *l = (UILabel *)[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] viewWithTag:1]; l.text = timeString; } @@ -207,7 +222,7 @@ dispatch_queue_t backgroundQueue; { UIButton * btn = sender; if (!btn) { - btn = (UIButton *)[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]] viewWithTag:2]; + btn = (UIButton *)[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] viewWithTag:2]; } switch (self.state) { case TIMER_STATE_RUNNING: @@ -231,7 +246,7 @@ dispatch_queue_t backgroundQueue; self.lastInterval = 0; self.state = TIMER_STATE_CLEARED; - UIButton *l = (UIButton *)[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]] viewWithTag:2]; + UIButton *l = (UIButton *)[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] viewWithTag:2]; [l setImage:[UIImage imageNamed:@"timer_start_btn"] forState:UIControlStateNormal]; [self updateTimer]; } -- cgit v1.2.3