0

我们通过以下方式在目标 c 中创建共享表:

NSMutableArray *sharingItems = [[NSMutableArray alloc] init];

          [sharingItems addObject:@"text"];
          [sharingItems addObject:fileName];


          UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];

          //need for iPads. Add subview in bottom to set the start to share view
          CGRect mainFrame = [[UIApplication sharedApplication].keyWindow.rootViewController view].frame;
          UIView *sourceView1 = [[UIView alloc] initWithFrame: CGRectMake(mainFrame.size.width, mainFrame.size.height, 0, 0)];
          [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:sourceView1];
      activityViewController.popoverPresentationController.sourceView = sourceView1;
          // Present share view
          [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:activityViewController animated:YES completion:nil];

然后显示输出

输出图像

如何根据设计宽度设置共享表宽度?

4

0 回答 0