This is the sixth day of my participation in the First Challenge 2022. For details: First Challenge 2022.

preface

Application scenarios of running horse light:

  1. IOS lottery roulette bezel animation

From CSDN download Demo:https://download.csdn.net/download/u011018979/16543761 principle: replace with NSTimer infinite background picture 1 and the background picture 2, the effect of entertaining diversions.


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    [self rotate:_rotaryTable];
    
}

/** iOS flip effect */
- (void)rotate:(id)sender {
    
[UIView beginAnimations:@"View Filp" context:nil];
[UIView setAnimationDelay:0.25];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:sender
                          cache:NO];
[UIView commitAnimations];
    
}

Copy the code

  1. In the to-do interface or workbench interface, often need to be applied to the place running lights

Principle: QMUIMarqueeLabel is used for cell encapsulation of simple horselight label control

Article: kunnan.blog.csdn.net/article/det…

If the user logs in without bound mobile phone number, prompt the user.

Simple running light label control, when the text exceeds the visible area of the label, automatically turn on the running light effect to show the text, and the text scroll is the end to end link effect

I iOS lottery roulette bezel animation

1.1 the principle

IOS lottery wheel border animation implementation principle: with NSTimer infinitely replace background picture 1 and background picture 2, to achieve the effect of running lantern.

Application scenario: iOS lottery roulette bezel animation

Matters needing attention in audit:

  1. Add a copy of “This event has nothing to do with Apple” on the lottery page.

2. Modify the grading to 17+ when submitting for review

1.2 Implementation Code

//
// ViewController.m
// horse_race_lamp
//
// Created by mac on 2021/4/7.
#import <Masonry/Masonry.h>


#import "ViewController.h"
NSString *const bg_horse_race_lamp_1=@"bg_horse_race_lamp_1";
NSString *const bg_horse_race_lamp_2=@"bg_horse_race_lamp_2";

@interface ViewController(a)
/** Replace bg_horse_race_lamp_1 and bg_horse_race_lamp_2 infinitely with NSTimer
@property (nonatomic.strong) UIImageView *rotaryTable;
@property (nonatomic.strong) NSTimer *itemBordeTImer;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    // Use the following two images, bg_lamp_1 bg_lamp_2, with NSTimer infinite replacement, to achieve the effect of running a lantern
    _rotaryTable = [UIImageView new];
    _rotaryTable.tag = 100;
    
    [_rotaryTable setImage:[UIImage imageNamed:bg_horse_race_lamp_1]];
    
    [self.view addSubview:_rotaryTable];
    
    [_rotaryTable mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.center.offset(0);
        
    }];
    
    
    
    _itemBordeTImer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(itemBordeTImerEvent) userInfo:nil repeats:YES];
    
    
    [[NSRunLoop currentRunLoop] addTimer:_itemBordeTImer forMode:NSRunLoopCommonModes];
    
    
    


    
    
}
// Frame animation
- (void)itemBordeTImerEvent
{
    if (_rotaryTable.tag == 100) {
        _rotaryTable.tag = 101;
        [_rotaryTable setImage:[UIImage imageNamed:bg_horse_race_lamp_2]];
    }else if (_rotaryTable.tag == 101){
        _rotaryTable.tag = 100;
        [_rotaryTable setImage:[UIImageimageNamed:bg_horse_race_lamp_1]]; }}@end

Copy the code

1.3 download the Demo

From Demo:https://download.csdn.net/download/u011018979/16543761 CSDN download

see also

More content please pay attention to # applets: iOS Reverse, only to present valuable information for you, focus on mobile technology research field; For more services and advice, please follow # publicid: iOS Reverse.