2013-03-11 82 views
0

我的应用程序有右栏按钮项目,custom badge徽章,当方向改变徽章转到导航栏右边栏按钮项目徽章的稳定位置

肖像

enter image description here

的中间景观:

enter image description here

-(void)viewDidAppear:(BOOL)animated 
{ 
    _customBadge1 = [CustomBadge customBadgeWithString:@"2" 
             withStringColor:[UIColor whiteColor] 
             withInsetColor:[UIColor redColor] 
             withBadgeFrame:YES 
            withBadgeFrameColor:[UIColor whiteColor] 
              withScale:1.0 
              withShining:YES]; 

    // Set Position of Badge 
    CGRect frameimgback2 = CGRectMake(742, 0, 20, 20); 
    _customBadge1.frame=frameimgback2; 
    [self.navigationController.navigationBar addSubview:_customBadge1]; 

} 

我该如何稳定这个始终保持在同一位置的徽章(在右侧栏按钮的右上方)?

感谢,

回答

1

尝试

_customBadge1.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | 
       UIViewAutoresizingFlexibleTopMargin); 
+0

感谢,行之有效。 – 2013-03-11 16:46:21

+0

如果有帮助,你能接受答案吗=) – msk 2013-03-11 16:56:29