Ios listens to view rotation angle, but kvo listens to transform cannot be realized. How to get rotation angle?

- (void)viewDidLoad {
    [super viewDidLoad];
    NSArray * imageList = @[@"Googleplus",@"Twitter",];
    
    UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 20, 100, 100)];
    imageView.backgroundColor = UIColor.redColor;
    [self.view addSubview:imageView];

    imageView.image = [UIImage imageNamed:imageList.firstObject];
    
    [imageView addObserver:self forKeyPath:@"transform" options:NSKeyValueObservingOptionNew context:nil];

    CABasicAnimation * rotationAnim = [CABasicAnimation animKeyPath:kTransformRotationY duration:2 fromValue:@0 toValue:@(2*M_PI) autoreverses:NO repeatCount:CGFLOAT_MAX];
    rotationAnim.delegate = self;
    [imageView.layer addAnimation:rotationAnim forKey:nil];

}

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
    NSLog(@"%@",change);
    
    
}
Jul.15,2021

KVO is not listenable. Because the value of CAAnimation changes quickly, and it has to be passed to the callback function, it is very expensive.

suitable for animated Synchronize with CADisplayLink.

For more information, see

Previous: Whether the scrapy retry request carries a new request header and proxy ip?

Next: How to use array_filter to add closure function Filter Array by PHP

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7c3247-97a6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7c3247-97a6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?