How do we update the toolbar item image color, which matches the color selected for tool items like ARROW, LINE, PEN tool, etc?
We also want to do similar to Android and Web, we want to hide our preset and make the last selected color in the toolbar tool color, Is there any way to do that? (Currently selected color from preset is setting as tool color)
For hiding preset we are using documentController.toolGroupToolbar.isPresetsToolbarEnabled = false
but it is hiding presets only for iPhone. We also tried isPresetsToolbarHidden but that is also not working. How can we hide preset tools from the toolbar on iPad and iPhone both?
Can you please share how can we do that? documentController.toolGroupToolbar = GroupToolbar()
we are getting toolGroupToolbar is get only property error.
We recently released v9.2.2 of the PDFTron iOS SDK and we added an API to set the style (colours) of the icon of a PTToolBarButtonItem:
e.g.
// Get the array of items in the default Draw toolbar
NSArray *drawItems = documentController.toolGroupToolbar.toolGroupManager.drawItemGroup.barButtonItems;
// Find the first ink tool item
PTToolBarButtonItem *inkItem = [drawItems objectAtIndex:[drawItems indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
return ((PTToolBarButtonItem*)obj).toolClass == [PTFreeHandCreate class];
}]];
// Create a new PTAnnotStyle and set its stroke color
PTAnnotStyle *style = [[PTAnnotStyle alloc] initWithAnnotType:PTExtendedAnnotTypeInk];
[style setStrokeColor:UIColor.greenColor];
// Set the style of the item's image
[inkItem setImageStyle:style];
Please let us know if you are able to test it out.
Are there any other remaining issues for which you need guidance or assistance?
You have provided a good solution for the PTFreeHandCreate tool code. We want to make it dynamic for any tool. and we are trying this with the following approach.
But after adding callout annotation, the app is getting freeze when moving it.
If we comment out this function it is working fine, Can you please check and help is it correct implementation?
Unfortunately I haven’t been able to reproduce this, do you have some more customizations in your code?
Attached is a video showing my test as well as the ViewController.swift file I used.
Apologies, that was just a copy and paste error from referencing an older version of the API. (tool as! PTToolBarButtonItem).setImageStyle(style) is the correct implementation.
I just tested again with this and am still unable to reproduce the issue.