簡體   English   中英

如何更改UIActivityViewController的大小

[英]How to change the size the UIActivityViewController

在我的應用中,我想共享圖像,文本和網址。 我這樣做如下:

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的整個屏幕。

我的屏幕截圖

我認為這是不成比例的,並且想調整控制器的高度,因此它只能容納一個需要的行。

[更新]我正在實際設備上運行此代碼(iPhone 5s運行iOS 8的最新Beta版),圖像的大小似乎無關緊要。 但是,在我的控制台中,我看到以下消息,這應該有助於解決此問題。

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 )>"
)

到目前為止,感謝您的反饋。

我剛剛將我的Xcode從Beta升級到6.01版,問題消失了。 謝謝你的耐心..

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM