iOS - UINavigationController adding multiple right items?

前端 未结 6 526
终归单人心
终归单人心 2021-02-01 15:07

I have a UINavigationController. I\'m trying to add multiple buttons on the right side of my navigationBar. How can I achieve this? What kind of button does it take

6条回答
  •  一整个雨季
    2021-02-01 15:41

    I used JRTurtons answer in Xcode 4.5, iOS 6 and implemented it like this and it works:

    // Two buttons at the right side of nav bar
    UIBarButtonItem *addAttachButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addAttachmentClicked:)];
    UIBarButtonItem *sendButton = [[UIBarButtonItem alloc] initWithTitle:LS(@"Send") style:UIBarButtonItemStyleBordered target:self action:@selector(sendClicked:)];
    self.navigationItem.rightBarButtonItems = @[addAttachButton,sendButton];
    

    However, I should mention, that UIBarButtonSystemItemPageCurl doesn't work like that.

提交回复
热议问题