I’m trying to make a functionality which will show the color of like and dislike, just like we like / dislike a video on YouTube. So, green color will represent the likes and the black color will represent the dislikes, their percentage will change on the click of two buttons, i have no idea how to do it..something like this pic but without showing the percentage

Just do the simple maths first. Calculate likes/totalHits ratio and then use a image for progressbar with center area transparent where you can fill color. Put a label behing this image and just give it green color. Then adjust the width of green colored label using this ratio we calculated. 🙂
Create a ImageView in xib file and set the image of progress bar with transparent center area
Create a label of same size as imageView and put it behind this imageView Created with black color
Create one more label of green color and put it in between this black label and Imageview.
Now its time to code 🙂
Now set the frame of green label as:
where x and y should be the same as of progress Bar imageView and height should also be the same, you just need to set the frame again and again while user tap on likes or dislikes button.
and to display percentage value create a label over progress bar and display value = ratio*100 in that label