Search code examples
ios5navigationtoolbarxcode4.3arrow-keys

Arrows at the bottom of the toolbar in iOS apps


Was wondering if anyone knew how to implement arrows in the bottom toolbar as shown below? Would be extremely grateful if someone could give me insight into this. I have seen a lot of apps with such arrows to navigate through pages and cannot seem to find them in XCode. See below...

THX :)

enter image description here


Solution

  • Just set a UIToolbar and attach it those two images (i'll give you the archive link with both images standard and retina): link

    //Creating UIToolbar
        toolBar = [[UIToolbar alloc]init];
        toolBar.frame = CGRectMake(//set some frame);
        toolBar.barStyle = UIBarStyleBlackOpaque;
        [toolBar sizeToFit]; 
    
        //Creating buttons
        UIBarButtonItem *prev = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"previous.png"] style:UIBarButtonItemStylePlain target:self action:@selector(myaction:)] autorelease]; 
    UIBarButtonItem *next = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"next.png"] style:UIBarButtonItemStylePlain target:self action:@selector(myaction:)] autorelease]; 
    
         //Creating the array with the buttons
         NSArray *items = [NSArray arrayWithObjects:prev,next, nil];
    
    //Assigning the array to the toolbar
    [toolBar setItems:items];
        [self.view addSubview:toolBar];
        [toolBar release]; 
    

    You are done!