UIActivity popover:如何只显示一行符号?
UIActivity popover: How to show only one row of symbols?
我的应用程序应该在按下按钮时向服务器发送图片。为此,我选择使用 AirDrop,并希望 UI 尽可能简单。现在我可以排除除 AirDrop 之外的所有活动,但弹出窗口仍然看起来很乱:
如何去掉多余的两条线?它们毫无用处。
如果有帮助,这里是点击按钮时调用的方法:
- (IBAction)orderButtonTapped:(UIButton *)sender {
UIImage *image = [self.detailViewController.paint extractImageFromBitmap];
UIDevice *device = UIDevice.currentDevice;
NSArray *items = @[device.name, image];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items
applicationActivities:nil];
activityViewController.excludedActivityTypes = @[UIActivityTypePostToFacebook,
UIActivityTypePostToTwitter,
UIActivityTypePostToWeibo,
UIActivityTypeMessage,
UIActivityTypeMail,
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo];
activityViewController.popoverPresentationController.sourceView = self.view;
// if iPhone
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
[self presentViewController:activityViewController animated:YES completion:nil];
}
// if iPad
else {
CGFloat xPos = self.orderButton.frame.origin.x + self.orderButton.frame.size.width/2;
CGFloat yPos = self.orderButton.frame.origin.y;
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
[popup presentPopoverFromRect:CGRectMake(xPos, yPos, 0, 0)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
}
你不能。 用户可以在那里自定义第 3 方活动。您不能只将选定的活动(例如 AirDrop)列入白名单,而只能将其中一些活动列入黑名单。这就是您已经在做的事情。
我的应用程序应该在按下按钮时向服务器发送图片。为此,我选择使用 AirDrop,并希望 UI 尽可能简单。现在我可以排除除 AirDrop 之外的所有活动,但弹出窗口仍然看起来很乱:
如何去掉多余的两条线?它们毫无用处。
如果有帮助,这里是点击按钮时调用的方法:
- (IBAction)orderButtonTapped:(UIButton *)sender {
UIImage *image = [self.detailViewController.paint extractImageFromBitmap];
UIDevice *device = UIDevice.currentDevice;
NSArray *items = @[device.name, image];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items
applicationActivities:nil];
activityViewController.excludedActivityTypes = @[UIActivityTypePostToFacebook,
UIActivityTypePostToTwitter,
UIActivityTypePostToWeibo,
UIActivityTypeMessage,
UIActivityTypeMail,
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo];
activityViewController.popoverPresentationController.sourceView = self.view;
// if iPhone
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
[self presentViewController:activityViewController animated:YES completion:nil];
}
// if iPad
else {
CGFloat xPos = self.orderButton.frame.origin.x + self.orderButton.frame.size.width/2;
CGFloat yPos = self.orderButton.frame.origin.y;
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
[popup presentPopoverFromRect:CGRectMake(xPos, yPos, 0, 0)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
}
你不能。 用户可以在那里自定义第 3 方活动。您不能只将选定的活动(例如 AirDrop)列入白名单,而只能将其中一些活动列入黑名单。这就是您已经在做的事情。