Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 7424b6d

Browse files
author
Adlai Holler
authored
Update examples to use UIControlState (#3013)
1 parent 2dca7a0 commit 7424b6d

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

examples/ASDKLayoutTransition/Sample/ViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ - (instancetype)init
6060
UIColor *buttonColor = [UIColor blueColor];
6161

6262
_buttonNode = [[ASButtonNode alloc] init];
63-
[_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:buttonColor forState:ASControlStateNormal];
64-
[_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:[buttonColor colorWithAlphaComponent:0.5] forState:ASControlStateHighlighted];
63+
[_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:buttonColor forState:UIControlStateNormal];
64+
[_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:[buttonColor colorWithAlphaComponent:0.5] forState:UIControlStateHighlighted];
6565

6666

6767
// Some debug colors

examples/ASDKTube/Sample/Nodes/VideoContentCell.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
126126
- (void)setMuteButtonIcon
127127
{
128128
if (_videoPlayerNode.muted) {
129-
[_muteButtonNode setImage:[UIImage imageNamed:@"ico-mute"] forState:ASControlStateNormal];
129+
[_muteButtonNode setImage:[UIImage imageNamed:@"ico-mute"] forState:UIControlStateNormal];
130130
} else {
131-
[_muteButtonNode setImage:[UIImage imageNamed:@"ico-unmute"] forState:ASControlStateNormal];
131+
[_muteButtonNode setImage:[UIImage imageNamed:@"ico-unmute"] forState:UIControlStateNormal];
132132
}
133133
}
134134

examples/ASMapNode/Sample/MapHandlerNode.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ - (instancetype)init
6565
borderColor:[UIColor lightGrayColor]
6666
borderWidth:2.0];
6767

68-
[_updateRegionButton setBackgroundImage:backgroundImage forState:ASControlStateNormal];
69-
[_updateRegionButton setBackgroundImage:backgroundHiglightedImage forState:ASControlStateHighlighted];
68+
[_updateRegionButton setBackgroundImage:backgroundImage forState:UIControlStateNormal];
69+
[_updateRegionButton setBackgroundImage:backgroundHiglightedImage forState:UIControlStateHighlighted];
7070

71-
[_liveMapToggleButton setBackgroundImage:backgroundImage forState:ASControlStateNormal];
72-
[_liveMapToggleButton setBackgroundImage:backgroundHiglightedImage forState:ASControlStateHighlighted];
71+
[_liveMapToggleButton setBackgroundImage:backgroundImage forState:UIControlStateNormal];
72+
[_liveMapToggleButton setBackgroundImage:backgroundHiglightedImage forState:UIControlStateHighlighted];
7373

7474
_updateRegionButton.contentEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5);
75-
[_updateRegionButton setTitle:@"Update Region" withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal];
75+
[_updateRegionButton setTitle:@"Update Region" withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal];
7676

7777
[_updateRegionButton addTarget:self action:@selector(updateRegion) forControlEvents:ASControlNodeEventTouchUpInside];
7878

79-
[_liveMapToggleButton setTitle:[self liveMapStr] withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal];
79+
[_liveMapToggleButton setTitle:[self liveMapStr] withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal];
8080

8181
[_liveMapToggleButton addTarget:self action:@selector(toggleLiveMap) forControlEvents:ASControlNodeEventTouchUpInside];
8282

@@ -214,8 +214,8 @@ - (void)toggleLiveMap
214214
{
215215
_mapNode.liveMap = !_mapNode.liveMap;
216216
NSString * const liveMapStr = [self liveMapStr];
217-
[_liveMapToggleButton setTitle:liveMapStr withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal];
218-
[_liveMapToggleButton setTitle:liveMapStr withFont:[UIFont systemFontOfSize:14] withColor:[UIColor blueColor] forState:ASControlStateHighlighted];
217+
[_liveMapToggleButton setTitle:liveMapStr withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal];
218+
[_liveMapToggleButton setTitle:liveMapStr withFont:[UIFont systemFontOfSize:14] withColor:[UIColor blueColor] forState:UIControlStateHighlighted];
219219
}
220220

221221
- (void)updateLocationTextWithMKCoordinateRegion:(MKCoordinateRegion)region

examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ - (void)setupData
198198

199199
// Set title for button node with a given font or color. If you pass in nil for font or color the default system
200200
// font and black as color will be used
201-
[buttonNode setTitle:@"Button Title Normal" withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal];
202-
[buttonNode setTitle:@"Button Title Highlighted" withFont:[UIFont systemFontOfSize:14] withColor:nil forState:ASControlStateHighlighted];
201+
[buttonNode setTitle:@"Button Title Normal" withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal];
202+
[buttonNode setTitle:@"Button Title Highlighted" withFont:[UIFont systemFontOfSize:14] withColor:nil forState:UIControlStateHighlighted];
203203
[buttonNode addTarget:self action:@selector(buttonPressed:) forControlEvents:ASControlNodeEventTouchUpInside];
204204

205205
parentNode = [self centeringParentNodeWithChild:buttonNode];

examples/Videos/Sample/ViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ - (ASButtonNode *)playButton;
147147
ASButtonNode *playButtonNode = [[ASButtonNode alloc] init];
148148

149149
UIImage *image = [UIImage imageNamed:@"playButton@2x.png"];
150-
[playButtonNode setImage:image forState:ASControlStateNormal];
151-
[playButtonNode setImage:[UIImage imageNamed:@"playButtonSelected@2x.png"] forState:ASControlStateHighlighted];
150+
[playButtonNode setImage:image forState:UIControlStateNormal];
151+
[playButtonNode setImage:[UIImage imageNamed:@"playButtonSelected@2x.png"] forState:UIControlStateHighlighted];
152152

153153
// Change placement of play button if necessary
154154
//playButtonNode.contentHorizontalAlignment = ASHorizontalAlignmentStart;

examples_extra/ASTraitCollection/Sample/OverrideViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ - (instancetype)init
3939
[self addSubnode:_textNode];
4040

4141
_buttonNode = [[ASButtonNode alloc] init];
42-
[_buttonNode setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Close"] forState:ASControlStateNormal];
42+
[_buttonNode setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Close"] forState:UIControlStateNormal];
4343
[self addSubnode:_buttonNode];
4444

4545
self.backgroundColor = [UIColor lightGrayColor];

examples_extra/Multiplex/Sample/ScreenNode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ - (void)setText:(NSString *)text
7171
NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:22.0f]};
7272
NSAttributedString *string = [[NSAttributedString alloc] initWithString:text
7373
attributes:attributes];
74-
[_buttonNode setAttributedTitle:string forState:ASControlStateNormal];
74+
[_buttonNode setAttributedTitle:string forState:UIControlStateNormal];
7575
[self setNeedsLayout];
7676
}
7777

0 commit comments

Comments
 (0)