1

I'm working on PSPDFKIT,

I need the solution for add and remove buttons from annotation toolbar.

and I want to change some default annotation images.

can anyone suggest me how to resolve those problems ,thanks in advance!!!

guptha
  • 529
  • 1
  • 4
  • 9

1 Answers1

0

add custom button while initializing PSPDFDocument in PSPDFViewController

PSPDFBrightnessBarButtonItem * brightnessBtn = [[PSPDFBrightnessBarButtonItem alloc] initWithPDFViewController:self]; // PSPDFKIT native button

UIBarButtonItem * closeBtn = [[UIBarButtonItem alloc] initWithTitle:@"Home" style:UIBarButtonItemStyleBordered target:self action:@selector(close:)]; // Custom button with title.

UIButton * moonBtn = [[UIButton alloc] initWithFrame:CGRectMake(0,0,20,20)]; // Custom button with image.
[moonBtn setImage:[UIImage imageNamed:@"icon____.png"] forState:UIControlStateNormal];[moonBtn addTarget:self action:@selector(moonTapped) forControlEvents:UIControlEventTouchDown];
UIBarButtonItem * moontab = [[UIBarButtonItem alloc] initWithCustomView:moonBtn];

If it is Navigation bar -

  navigationItem.leftBarButtonItems/rightBarButtonItems = @[brightnessBtn, closeBtn, moontab];

If it is Toolbar -

 [toolbar setItems:@[brightnessBtn, closeBtn, moontab]];
Vedchi
  • 1,200
  • 6
  • 14
  • Hi, can you tell me where you get your `toolbar` object from? Is it `self.annotationToolbarController?.annotationToolbar` ? – emmics Jun 06 '17 at 14:26