Closed ghost closed 8 years ago
@william205 I have the same problem,what's your solution?Thanks.
I managed to fix it by changing a line of code in the ZSSRichTextEditor.m source file.
Try going to the following method:
- (NSArray *)itemsForToolbar
Then find
// Image From Device
if ((_enabledToolbarItems && [_enabledToolbarItems containsObject:ZSSRichTextEditorToolbarInsertImageFromDevice]) || (_enabledToolbarItems && [_enabledToolbarItems containsObject:ZSSRichTextEditorToolbarAll])) {
ZSSBarButtonItem *insertImageFromDevice = [[ZSSBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ZSSimageDevice.png"] style:UIBarButtonItemStylePlain target:self action:@selector(insertImageFromDevice)];
insertImageFromDevice.label = @"imageFromDevice";
if (customOrder) {
[items replaceObjectAtIndex:[_enabledToolbarItems indexOfObject:ZSSRichTextEditorToolbarInsertImage] withObject:insertImageFromDevice];
} else {
[items addObject:insertImageFromDevice];
}
}
I changed the following line:
[items replaceObjectAtIndex:[_enabledToolbarItems indexOfObject:ZSSRichTextEditorToolbarInsertImage] withObject:insertImageFromDevice];
to:
[items replaceObjectAtIndex:[_enabledToolbarItems indexOfObject:ZSSRichTextEditorToolbarInsertImageFromDevice] withObject:insertImageFromDevice];
After I did that it all worked perfectly.
Can you submit a PR for this?
Pull request submitted
Merged. Thanks!
No problem
Thanks.
There also have a small problem. The ZSSimageDevice.png
image was not placed in the same path with others.
I will submit a pull request for that to.
When using a custom order with a select few bar button items, if I include ZSSToolbarInsertImageFromDevice I get a crash on:
self.toolbar.items = items; (line 715 in buildToolBar method)
Error:
*\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString view]: unrecognized selector sent to instance 0x100228460'