Slide UIBarButtonItem

Discussion in 'iOS Programming' started by IDMah, Feb 22, 2012.

  1. macrumors regular

    Joined:
    May 13, 2011
    #1
    Hi I've got a right button ala:

    Code:
    -(id)init
    {
    	//[[self navigationItem] setTitle:[NSString stringWithFormat:@"%@ Cards",[company companyName]]];
    	UIBarButtonItem *bby = [[UIBarButtonItem alloc]
    				initWithBarButtonSystemItem:UIBarButtonSystemItemCamera 
    				target:self
    				action:@selector(switchToQRCodeReader)];
    	
    	// set this bar button to the right side item in the navigationItem //
    	[[self navigationItem] setRightBarButtonItem:bby animated:YES];
    	[bby release];
    }
    
    and the same button on another View. the Left button slides in/out ok, but the right button floats. How do I get the RightButton to slide as well?

    thanks
    Ian
     
  2. macrumors newbie

    OverByThere

    Joined:
    Nov 24, 2011
    Location:
    Rugby, UK
    #2
    Hi,

    I'm not sure what you mean by "floats"?

    I would recommend you put this code into -(void)viewDidLoad, and then if possible give us screenshots to further diagnose the issue?
     
  3. thread starter macrumors regular

    Joined:
    May 13, 2011
    #3
    I'll try words first.

    I have a ListView with [camera icon] and stuffView with [camera icon].
    so as the stuffView slides off the [Camera icon] stays on right obscuring the stuffView Label and anything on the left .

    What I would like is for the camera icon to slide off with the ListView and a [New Camera Icon] slide on from the right nailed with the stuffView.

    I might just live with it, but a solution would be great.

    adding it to viewDidLoad did nothing..
    thanks
    Ian
     
  4. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #4
    You are then (by reading your lines), adding the icons to the wrong navigationBar, or you're navigation tree is corrupted (doesn't it say that in the logs?). Because this should be automated, and if it isn't, it's an error on the code of switching etc.
     

Share This Page