UIButton not clickable when custom view called
When adding a custom subview to a UIButton you have to turn off the userInteractionEnabled property.
customView.userInteractionEnabled = NO;
then add to your button.
[customButton addSubView:customView];
Otherwise your custom view intercepts touch events before the button since it's added to the top of the view stack.
Here the problem is the Line below ,As the new child view must be according to the parent view
newViewBtn.frame =CGRectMake(randNumX+5,randNumY+5,60,20);
writting the above as below solved the problem
newViewBtn.frame =CGRectMake(5,5,60,20);