How do I create a standard iOS Share button?

后端 未结 7 487
情话喂你
情话喂你 2020-12-30 19:13

The iOS Human Interface Guidelines say:

Use the system-provided Share button. Users are familiar with the meaning and behavior of thi

7条回答
  •  被撕碎了的回忆
    2020-12-30 19:43

    Here is the code. I am assuming you are inside ViewController so self has navigationItem property.

    UIBarButtonItem *shareButton = [[UIBarButtonItem alloc]
    initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                         target:self
                         action:@selector(shareAction:)];
    self.navigationItem.rightBarButtonItem = shareButton;
    

提交回复
热议问题