How to calculate angle between two point and rotate a uiview to pint to these two point?
===

I am making a pointed arrow in one UIView class's drawRect method with arrow length fixed.
I have to calculate the center and rotation angle of the ArrowView and then add it to my view such that the arrow appears pointing from source to destination.

the  code which iam using is

    -(void)addArrowForChessMove:(CGPoint)source andDestination:(CGPoint)destination
    {
        
        CGPoint centerOfArrow=CGPointMake((abs(source.x+destination.x)/2), (abs(source.y+destination.y)/2));
        
        DrawExperiment *drw=[[DrawExperiment alloc]initWithArrowHeight:70];
        drw.frame=CGRectMake(0,0, 25, 70);
        [drw setCenter:centerOfArrow];
        [drw setBackgroundColor:[UIColor clearColor]];
        [drw setTag:1002];
        
        float angleVal = atan2(abs(destination.x - source.x) , abs(destination.y - source.y))*180/M_PI;
        drw.transform=CGAffineTransformMakeRotation(angleVal);
        [self.view addSubview:drw];
        [self.view bringSubviewToFront:[self.view viewWithTag:1002]];
    
        
        
        
    }`

` 
the code works fine for horizontal or vertical axis but when points are at an angle other then multiple of 90 then result is at time opposite.


what is the thing which i am missing..thanks



NOTE :- I welcome Mark down as a healthy critisism but pls do write the reason of your markdown in comment so that i can improve 