如何更改UIActivityViewController的大小
在我的应用程序中,我想分享一个图像,文字和url。 我这样做如下:
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的整个屏幕,虽然它只显示四个共享图标。
我认为这是不成比例的,并想调整控制器的高度,所以它只适应那一个需要的行。
[更新]我在真实的设备上运行这个代码(运行最新的iOS 8testing版的iPhone 5),图像的大小似乎并不重要。 但是,在我的控制台中,我看到以下消息,这应该有助于解决问题。
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 )>" )
感谢您的反馈。
我刚从testing版升级我的Xcode到版本6.01,问题就消失了。 谢谢你的耐心..