From 7424b6d7f7da803282ee3b027ca77384efe260eb Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 10 Feb 2017 13:35:15 -0800 Subject: [PATCH] Update examples to use UIControlState (#3013) --- .../ASDKLayoutTransition/Sample/ViewController.m | 4 ++-- .../ASDKTube/Sample/Nodes/VideoContentCell.m | 4 ++-- examples/ASMapNode/Sample/MapHandlerNode.m | 16 ++++++++-------- .../Sample/OverviewComponentsViewController.m | 4 ++-- examples/Videos/Sample/ViewController.m | 4 ++-- .../Sample/OverrideViewController.m | 2 +- examples_extra/Multiplex/Sample/ScreenNode.m | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/ASDKLayoutTransition/Sample/ViewController.m b/examples/ASDKLayoutTransition/Sample/ViewController.m index 789d5029c4..71f025cd69 100644 --- a/examples/ASDKLayoutTransition/Sample/ViewController.m +++ b/examples/ASDKLayoutTransition/Sample/ViewController.m @@ -60,8 +60,8 @@ UIColor *buttonColor = [UIColor blueColor]; _buttonNode = [[ASButtonNode alloc] init]; - [_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:buttonColor forState:ASControlStateNormal]; - [_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:[buttonColor colorWithAlphaComponent:0.5] forState:ASControlStateHighlighted]; + [_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:buttonColor forState:UIControlStateNormal]; + [_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:[buttonColor colorWithAlphaComponent:0.5] forState:UIControlStateHighlighted]; // Some debug colors diff --git a/examples/ASDKTube/Sample/Nodes/VideoContentCell.m b/examples/ASDKTube/Sample/Nodes/VideoContentCell.m index ca214c7af1..be0998300a 100644 --- a/examples/ASDKTube/Sample/Nodes/VideoContentCell.m +++ b/examples/ASDKTube/Sample/Nodes/VideoContentCell.m @@ -126,9 +126,9 @@ - (void)setMuteButtonIcon { if (_videoPlayerNode.muted) { - [_muteButtonNode setImage:[UIImage imageNamed:@"ico-mute"] forState:ASControlStateNormal]; + [_muteButtonNode setImage:[UIImage imageNamed:@"ico-mute"] forState:UIControlStateNormal]; } else { - [_muteButtonNode setImage:[UIImage imageNamed:@"ico-unmute"] forState:ASControlStateNormal]; + [_muteButtonNode setImage:[UIImage imageNamed:@"ico-unmute"] forState:UIControlStateNormal]; } } diff --git a/examples/ASMapNode/Sample/MapHandlerNode.m b/examples/ASMapNode/Sample/MapHandlerNode.m index 33e09a5b69..3d7173783b 100644 --- a/examples/ASMapNode/Sample/MapHandlerNode.m +++ b/examples/ASMapNode/Sample/MapHandlerNode.m @@ -65,18 +65,18 @@ borderColor:[UIColor lightGrayColor] borderWidth:2.0]; - [_updateRegionButton setBackgroundImage:backgroundImage forState:ASControlStateNormal]; - [_updateRegionButton setBackgroundImage:backgroundHiglightedImage forState:ASControlStateHighlighted]; + [_updateRegionButton setBackgroundImage:backgroundImage forState:UIControlStateNormal]; + [_updateRegionButton setBackgroundImage:backgroundHiglightedImage forState:UIControlStateHighlighted]; - [_liveMapToggleButton setBackgroundImage:backgroundImage forState:ASControlStateNormal]; - [_liveMapToggleButton setBackgroundImage:backgroundHiglightedImage forState:ASControlStateHighlighted]; + [_liveMapToggleButton setBackgroundImage:backgroundImage forState:UIControlStateNormal]; + [_liveMapToggleButton setBackgroundImage:backgroundHiglightedImage forState:UIControlStateHighlighted]; _updateRegionButton.contentEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5); - [_updateRegionButton setTitle:@"Update Region" withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal]; + [_updateRegionButton setTitle:@"Update Region" withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal]; [_updateRegionButton addTarget:self action:@selector(updateRegion) forControlEvents:ASControlNodeEventTouchUpInside]; - [_liveMapToggleButton setTitle:[self liveMapStr] withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal]; + [_liveMapToggleButton setTitle:[self liveMapStr] withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal]; [_liveMapToggleButton addTarget:self action:@selector(toggleLiveMap) forControlEvents:ASControlNodeEventTouchUpInside]; @@ -214,8 +214,8 @@ { _mapNode.liveMap = !_mapNode.liveMap; NSString * const liveMapStr = [self liveMapStr]; - [_liveMapToggleButton setTitle:liveMapStr withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal]; - [_liveMapToggleButton setTitle:liveMapStr withFont:[UIFont systemFontOfSize:14] withColor:[UIColor blueColor] forState:ASControlStateHighlighted]; + [_liveMapToggleButton setTitle:liveMapStr withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal]; + [_liveMapToggleButton setTitle:liveMapStr withFont:[UIFont systemFontOfSize:14] withColor:[UIColor blueColor] forState:UIControlStateHighlighted]; } - (void)updateLocationTextWithMKCoordinateRegion:(MKCoordinateRegion)region diff --git a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m index 798c9e2a95..c49f64cca2 100644 --- a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m +++ b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m @@ -198,8 +198,8 @@ typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constr // Set title for button node with a given font or color. If you pass in nil for font or color the default system // font and black as color will be used - [buttonNode setTitle:@"Button Title Normal" withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal]; - [buttonNode setTitle:@"Button Title Highlighted" withFont:[UIFont systemFontOfSize:14] withColor:nil forState:ASControlStateHighlighted]; + [buttonNode setTitle:@"Button Title Normal" withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal]; + [buttonNode setTitle:@"Button Title Highlighted" withFont:[UIFont systemFontOfSize:14] withColor:nil forState:UIControlStateHighlighted]; [buttonNode addTarget:self action:@selector(buttonPressed:) forControlEvents:ASControlNodeEventTouchUpInside]; parentNode = [self centeringParentNodeWithChild:buttonNode]; diff --git a/examples/Videos/Sample/ViewController.m b/examples/Videos/Sample/ViewController.m index 6b2bbc33fb..b0de8101b3 100644 --- a/examples/Videos/Sample/ViewController.m +++ b/examples/Videos/Sample/ViewController.m @@ -147,8 +147,8 @@ ASButtonNode *playButtonNode = [[ASButtonNode alloc] init]; UIImage *image = [UIImage imageNamed:@"playButton@2x.png"]; - [playButtonNode setImage:image forState:ASControlStateNormal]; - [playButtonNode setImage:[UIImage imageNamed:@"playButtonSelected@2x.png"] forState:ASControlStateHighlighted]; + [playButtonNode setImage:image forState:UIControlStateNormal]; + [playButtonNode setImage:[UIImage imageNamed:@"playButtonSelected@2x.png"] forState:UIControlStateHighlighted]; // Change placement of play button if necessary //playButtonNode.contentHorizontalAlignment = ASHorizontalAlignmentStart; diff --git a/examples_extra/ASTraitCollection/Sample/OverrideViewController.m b/examples_extra/ASTraitCollection/Sample/OverrideViewController.m index 7ca5f877f4..008497f9d8 100644 --- a/examples_extra/ASTraitCollection/Sample/OverrideViewController.m +++ b/examples_extra/ASTraitCollection/Sample/OverrideViewController.m @@ -39,7 +39,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; [self addSubnode:_textNode]; _buttonNode = [[ASButtonNode alloc] init]; - [_buttonNode setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Close"] forState:ASControlStateNormal]; + [_buttonNode setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Close"] forState:UIControlStateNormal]; [self addSubnode:_buttonNode]; self.backgroundColor = [UIColor lightGrayColor]; diff --git a/examples_extra/Multiplex/Sample/ScreenNode.m b/examples_extra/Multiplex/Sample/ScreenNode.m index 06ae9e7dcc..391e2ff44e 100644 --- a/examples_extra/Multiplex/Sample/ScreenNode.m +++ b/examples_extra/Multiplex/Sample/ScreenNode.m @@ -71,7 +71,7 @@ NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:22.0f]}; NSAttributedString *string = [[NSAttributedString alloc] initWithString:text attributes:attributes]; - [_buttonNode setAttributedTitle:string forState:ASControlStateNormal]; + [_buttonNode setAttributedTitle:string forState:UIControlStateNormal]; [self setNeedsLayout]; }