0

My app has a badge on right bar button item, custom badge ,when orientation changes badge goes to middle of the navigation bar

portrait

enter image description here

landscape:

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];

}

How can I stable this badge that will always stay in the same postion (on right upper side of right bar button.) ?

Thanks,

4

1 に答える 1

1

試す

_customBadge1.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
               UIViewAutoresizingFlexibleTopMargin);
于 2013-03-11T16:43:13.507 に答える