如何更改UIActivityViewController的大小 [英] How to change the size the UIActivityViewController
问题描述
在我的应用中,我想共享图像,文本和网址.我这样做如下:
In my app, I want to share an image, text and url. I do that as follows:
UIActivityViewController *controller = [[UIActivityViewController alloc]
initWithActivityItems:@[text, url, image]
applicationActivities:nil];
controller.excludedActivityTypes = @[UIActivityTypePostToWeibo,
//UIActivityTypeMessage,
//UIActivityTypeMail,
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo,
UIActivityTypeAirDrop];
[self presentViewController:controller animated:YES completion:nil];
不幸的是,结果,模式对话框覆盖了我iPhone的整个屏幕,尽管它只显示四个共享图标.
Unfortunately, as a result, the modal dialog covers the whole screen of my iphone, although it only displays four share icons.
我认为这是不成比例的,并且希望调整控制器的高度,因此它只能容纳该行.
I think that is out of proportion, and would like to adjust the height of the controller, so it only accommodates that one needed row.
[更新]我在真实设备上运行此代码(iPhone 5s运行iOS 8的最新Beta版),图像的大小似乎无关紧要.但是,在控制台中,我看到以下消息,这应该有助于解决此问题.
[Update] I am running this code on a real device (iPhone 5s running the very latest beta of iOS 8), and the size of the image doesn't seem to matter. However, in my console I see the following messages, that should help to fix the issue.
2014-09-17 15:24:27.068 AppName[1826:747596] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x17008a5a0 UIView:0x1781945d0.bottom == _UIAlertControllerView:0x13c51ea00.bottom>",
"<NSLayoutConstraint:0x17008aeb0 V:|-(0)-[UIView:0x178194d20] (Names: '|':_UIAlertControllerView:0x13c51ea00 )>",
"<NSLayoutConstraint:0x17008af50 UIView:0x178194d20.bottom <= _UIAlertControllerView:0x13c51ea00.bottom>",
"<NSLayoutConstraint:0x17008afa0 UIView:0x1781945d0.centerY == UIView:0x178194d20.centerY>",
"<NSLayoutConstraint:0x17008a550 V:|-(>=8)-[UIView:0x1781945d0] (Names: '|':_UIAlertControllerView:0x13c51ea00 )>"
)
感谢您到目前为止的反馈.
Thanks for your feedback so far.
推荐答案
我刚刚将Xcode从Beta升级到了6.01版,问题消失了.感谢您的耐心等候.
I just upgraded my Xcode from beta to release 6.01 and the problem disappeared. Thanks for your patience..
这篇关于如何更改UIActivityViewController的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!