February 7, 2014 · 0 Comments
UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 75, 44)]; NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2]; UIBarButtonItem *composeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(toggleDelete:)]; [buttons addObject:composeButton]; UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; fixedSpace.width = 5; [buttons addObject:fixedSpace]; UIBarButtonItem* bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(touchMe:)]; [buttons addObject:bi]; [tools setItems:buttons animated:NO]; tools.barStyle = -1; //self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools]; [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:deleteButton, bi, nil]]; [bi release]; [fixedSpace release]; [composeButton release]; [buttons release]; [tools release];