小编Est*_*i M的帖子

ios共享扩展帖子按钮标题

我想在SLComposeServiceViewController中更改帖子按钮的标题.我设法得到了UIButton:

NSArray* subviews =[self.navigationController.navigationBar subviews];
UIButton* postButton =[subviews lastObject];
Run Code Online (Sandbox Code Playgroud)

我试图设置这样的标题:

[postButton setTitle:@"Save" forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)

但标题没有改变.

谁能帮我这个?

我在iPad上看到了Evernote的分享扩展,它看起来像这样: 在此输入图像描述

UPDATE

我的解决方案

我找到了问题的解决方案,我删除了原始导航栏并创建了自定义导航栏.

我有两个导航栏:1.带"取消"\"保存"按钮2.带"后退"按钮

导航到其他viewcontroller时我改变它们(在我的情况下我需要上传文件,用户需要从列表中选择位置)

注意:如果您没有实现configurationItems,则只需要第一个导航栏.(只需调用以设置自定义导航栏viewDidAppear

所以我的代码在这里:

@property (strong, nonatomic) UINavigationBar *customNavBar;

-(void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];  
    self.customNavBar = [[UINavigationBar alloc] initWithFrame:self.navigationController.navigationBar.bounds];
    [self.navigationController.navigationBar removeFromSuperview];
    [self.navigationController.view addSubview:self.customNavBar];
    [self setCancelSaveNavigationItem];
}
Run Code Online (Sandbox Code Playgroud)

setCancelSaveNavigationItem - >从shareViewController的viewDidAppear调用

-(void)setCancelSaveNavigationItem
{
    UINavigationItem *newItem = [[UINavigationItem alloc] init];
    UIBarButtonItem *cancelBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",nil)  style:UIBarButtonItemStylePlain target:self action:@selector(cancelButtonTapped:)];
    UIBarButtonItem *saveBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done",nil)  style:UIBarButtonItemStyleDone target:self action:@selector(saveButtonTapped:)];
    newItem.leftBarButtonItem = cancelBarButtonItem; …
Run Code Online (Sandbox Code Playgroud)

ios ios8-share-extension

7
推荐指数
2
解决办法
2775
查看次数

JavaScript Phonegap打开PDF文件

如何在没有插件的情况下打开PDF文件?我试过了:window.open(path, '_blank', 'fullscreen=yes'); 在编辑器中打开空白页面.

javascript cordova

5
推荐指数
1
解决办法
4361
查看次数

标签 统计

cordova ×1

ios ×1

ios8-share-extension ×1

javascript ×1