-4

It is possible to add UIButton with background programatically in the toolbar and when I click on to the button it will display a uiActionSheet to let me take a picture from camera or from Photos Galery and when I select a picture it returns to the view and the background of the UIButton in toolbar change .

BenMorel
  • 34,448
  • 50
  • 182
  • 322
  • 1
    you should look to [UIBarButton](https://developer.apple.com/library/ios/documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html) – Janak Nirmal Jan 06 '14 at 08:55
  • 1
    What you have to tried ??? just search on google you will find lots of example to add button on toolbar and then search about UIAlertView and its delegate method you will get all of the feature which you need :) all the best :) http://stackoverflow.com/questions/14251224/iphone-sdk-how-to-uibutton-in-uitoolbar – iPatel Jan 06 '14 at 08:57
  • I think that i can't use UIBarButton if i want to change the background Image of the button , that's why i want to add a uibutton – user3162198 Jan 06 '14 at 08:57
  • U are telling about navigation bar, Right. Then U have to do using UIBarButton, then, be clear what U want to do with the button – chandru Jan 06 '14 at 08:58
  • U are telling about navigation bar, Right. Then U have to do using – chandru Jan 06 '14 at 09:02
  • Instead of it add UIButton in toolbar in xib. And change properties of it programmatically according to requirement. – python Jan 06 '14 at 08:57

1 Answers1

0

Create UIBarButton from UIButton:

NSMutableArray *mutableItem = [[NSMutableArray alloc]initWithArray:toolbar.items];
UIBarButton *bookmark = [[UIBarButtonItem alloc] initWithCustomView:_m_bmBtn];
[mutableItem addObject:bookmark];
self.m_toolbarTop.items= mutableItem;

Hide / show another button:

  1. button.hidden = YES/ NO.

  2. Remove item in mutableItem and set: self.m_toolbarTop.items= mutableItem;

Matthias
  • 12,053
  • 4
  • 49
  • 91
HoanNguyen
  • 405
  • 2
  • 12