【发布时间】:2013-11-11 08:30:58
【问题描述】:
我正在尝试将 customBadge 添加为 UIButton 的子视图 -
这是我目前的代码 -
//msg count initiaition
//CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:@"2"];
CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:@"2"
withStringColor:[UIColor whiteColor]
withInsetColor:[UIColor redColor]
withBadgeFrame:YES
withBadgeFrameColor:[UIColor redColor]
withScale:2.0
withShining:YES];
// Set Position of Badge 1
[customBadge1 setFrame:CGRectMake(self.view.frame.size.width/2-customBadge1.frame.size.width/2+_MsgHeadBtn.frame.size.width/2, 110, customBadge1.frame.size.width, customBadge1.frame.size.height)];
//add badge to view
[_MsgHeadBtn addSubview:customBadge1];
我尝试添加子视图的按钮是 _MsgHeadBtn,它是下面屏幕截图左上方的电子邮件图标。 我试图让自定义徽章略微显示在电子邮件图标的上方和右侧 - 但我最终得到了屏幕截图中的结果!
谁能提供任何关于我哪里出错的建议!?
【问题讨论】:
标签: ios objective-c uibutton addsubview