mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-10 08:20:16 +00:00
Update examples to use UIControlState (#3013)
This commit is contained in:
parent
2dca7a0c8d
commit
7424b6d7f7
@ -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
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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];
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user