I\'m trying to add a customBadge as a subview of a UIButton -
this is my code so far -
//msg count initiaition
//CustomBadge *customBadge1 = [Custom
Issue is within your setFrame:
method. You are using self.view.frame.size.width
.
Check with this code:
[customBadge1 setCenter:CGPointMake(_MsgHeadBtn.frame.size.width, 0)];
[_MsgHeadBtn addSubview:customBadge1];
or
[customBadge1 setFrame:CGRectMake(_MsgHeadBtn.frame.size.width, 0, customBadge1.frame.size.width, customBadge1.frame.size.height)];
[_MsgHeadBtn addSubview:customBadge1];
Adjust your frame like below:
[customBadge1 setFrame:CGRectMake(_MsgHeadBtn.frame.size.width-customBadge1.frame.size.width,-customBadge1.frame.size.height/2, customBadge1.frame.size.width, customBadge1.frame.size.height)];