【问题标题】:dynamically add and remove buttons from the PSPDF kit in ios在 ios 中动态添加和删除 PSPDF 工具包中的按钮
【发布时间】:2013-11-17 06:42:00
【问题描述】:

我正在处理PSPDFKIT

我需要注释工具栏中add and remove buttons 的解决方案。

我想change some default annotation images

谁能建议我如何解决这些问题,提前谢谢!!!

【问题讨论】:

    标签: ios ipad pdf ios6 pspdfkit


    【解决方案1】:

    PSPDFViewController中初始化PSPDFDocument时添加自定义按钮

    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];
    

    如果是导航栏-

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

    如果是工具栏-

     [toolbar setItems:@[brightnessBtn, closeBtn, moontab]];
    

    【讨论】:

    • 嗨,你能告诉我你的toolbar对象是从哪里得到的吗?是self.annotationToolbarController?.annotationToolbar 吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 2019-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多