| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- //
- // fakes.h
- // FLEX
- //
- // Created by Kevin Bradley on 12/22/20.
- // Copyright © 2020 Flipboard. All rights reserved.
- //
- #import "fakes.h"
- @implementation UIFakeDatePicker
- - (void)setCalendar:(NSCalendar *)calendar {
- }
- - (void)setDate:(NSDate *_Nonnull)date animated:(BOOL)animated {
-
- }
- - (NSCalendar *)calendar {
- return [NSCalendar currentCalendar];
- }
- - (NSInteger) numberOfComponents {
- return 0;
- }
- - (NSInteger)numberOfRowsInComponent:(NSInteger)component {
- return 0;
- }
- - (CGSize)rowSizeForComponent:(NSInteger)component {
- return CGSizeZero;
- }
- - (nullable UIView *)viewForRow:(NSInteger)row forComponent:(NSInteger)component {
- return nil;
- }
- // Reloading whole view or single component
- - (void)reloadAllComponents {
-
- }
- - (void)reloadComponent:(NSInteger)component {
-
- }
- // selection. in this case, it means showing the appropriate row in the middle
- - (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated {
-
- }
- - (NSInteger)selectedRowInComponent:(NSInteger)component {
- return -1;
- }
- @end
- @interface UIFakeSwitch() {
- BOOL _isOn;
- }
- @end
- @implementation UIFakeSwitch
- - (BOOL)isOn {
- return _isOn;
- }
- - (void)setOn:(BOOL)on{
- [self setOn:on animated:true];
- }
- - (NSString *)onTitle {
- return @"TRUE";
- }
- - (NSString *)offTitle {
- return @"FALSE";
- }
- - (void)setOn:(BOOL)on animated:(BOOL)animated {
- _isOn = on;
- if (_isOn){
- [self setTitle:[self onTitle] forState:UIControlStateNormal];
- } else {
- [self setTitle:[self offTitle] forState:UIControlStateNormal];
- }
- //[self sendActionsForControlEvents:[self allControlEvents]];
- }
- + (id)newSwitch {
- return [UIFakeSwitch buttonWithType:UIButtonTypeSystem];
- }
- -(instancetype)initWithFrame:(CGRect)frame {
- return [super initWithFrame:frame];
- }
- - (instancetype)initWithCoder:(id)coder {
- LOG_SELF;
- return [super initWithCoder:coder];
- }
- @end
- @implementation UIFakeSlider
- - (void)setValue:(float)value animated:(BOOL)animated {
-
- }
- - (void)setThumbImage:(nullable UIImage *)image forState:(UIControlState)state {
-
- }
- - (void)setMinimumTrackImage:(nullable UIImage *)image forState:(UIControlState)state {
-
- }
- - (void)setMaximumTrackImage:(nullable UIImage *)image forState:(UIControlState)state {
-
- }
- - (nullable UIImage *)thumbImageForState:(UIControlState)state {
- return nil;
- }
- - (nullable UIImage *)minimumTrackImageForState:(UIControlState)state {
- return nil;
- }
- - (nullable UIImage *)maximumTrackImageForState:(UIControlState)state {
- return nil;
- }
- - (CGRect)minimumValueImageRectForBounds:(CGRect)bounds {
- return CGRectZero;
- }
- - (CGRect)maximumValueImageRectForBounds:(CGRect)bounds {
- return CGRectZero;
- }
- - (CGRect)trackRectForBounds:(CGRect)bounds {
- return CGRectZero;
- }
- - (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value {
- return CGRectZero;
- }
- @end
|