1

点击 Twitter 和 Facebook 的 Tweet 或 Share 时出现的“文本框”。那些是什么做的?可以制作类似的东西吗?我正在尝试自定义它们,以便它将作为 tableView 的“评论”。我说的是这两个:

在此处输入图像描述

我试图让它说“评论”而不是“推文”和“Facebook”。然后是“完成”,上面写着“发送”和“发布”。知道如何/在哪里可以创建/自定义这些吗?

4

1 回答 1

4

这些是私有视图控制器。你不能(好吧,不应该)自定义它们——你必须自己重新实现它们。

但是,您可以使用私有方法-recursiveDescription来了解视图层次结构的构造方式。创建一个简单的应用程序,使用UIActivityViewController. 展示它,选择 Twitter 或 Facebook,然后在调试器中暂停应用程序。在控制台中键入po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]以列出当前视图层次结构。

编辑:好的,我很好奇……</p>

   | <UIImageView: 0x75c7830; frame = (0 0; 320 568); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x75c7890>>
   | <UIView: 0x75c7900; frame = (0 20; 320 548); opaque = NO; autoresize = LM+W+RM+H; layer = <CALayer: 0x75c7960>>
   |    | <SLTwitterSheetCardView: 0x75b4950; frame = (-9 25; 337 188); opaque = NO; autoresize = W+H; layer = <CALayer: 0x75b4a40>>
   |    |    | <UIView: 0x75c86b0; frame = (13 0; 311 188); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x75c8710>>
   |    |    |    | <UIImageView: 0x767b680; frame = (0 3; 311 184); clipsToBounds = YES; alpha = 0.75; opaque = NO; autoresize = W+TM+H; userInteractionEnabled = NO; layer = <CALayer: 0x767e4a0>>
   |    |    |    | <UIImageView: 0x7678a50; frame = (0 0; 311 188); opaque = NO; autoresize = W+H+BM; userInteractionEnabled = NO; layer = <CALayer: 0x767b8b0>>
   |    |    |    | <UIView: 0x75c8770; frame = (0 0; 311 188); autoresize = W+H; layer = <CALayer: 0x75c87d0>>
   |    |    |    |    | <SLTwitterExpandedHitTestView: 0x767d950; frame = (6 155; 303 26); opaque = NO; autoresize = RM+TM; layer = <CALayer: 0x767da00>>
   |    |    |    |    |    | <SLTwitterExpandedHitTestImageView: 0x767ea60; baseClass = UIImageView; frame = (30 -6; 272 42); alpha = 0; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x767eb10>>
   |    |    |    |    |    | <SLTwitterExpandedHitTestButton: 0x767a4e0; baseClass = UIButton; frame = (5 5; 21 21); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x767a5a0>>
   |    |    |    |    |    |    | <UIImageView: 0x7176770; frame = (0 0; 21 21); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x719cb70>>
   |    |    |    |    |    |    | <UIButtonLabel: 0x767c680; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x767bbe0>>
   |    |    |    |    |    | <SLTwitterExpandedHitTestButton: 0x7193d10; baseClass = UIButton; frame = (120 7; 17 17); alpha = 0; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7193660>>
   |    |    |    |    |    |    | <UIImageView: 0x7172000; frame = (0 0; 17 17); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x719da50>>
   |    |    |    |    |    |    | <UIButtonLabel: 0x7194900; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x71949a0>>
   |    |    |    |    |    | <SLTwitterExpandedHitTestButton: 0x767d1a0; baseClass = UIButton; frame = (29 -1; 84 37); alpha = 0.8; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x767d260>>
   |    |    |    |    |    |    | <UIButtonLabel: 0x767d580; frame = (0 9; 84 16); text = 'Add Location'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x767d620>>
   |    |    |    | <UIView: 0x7678160; frame = (0 0; 311 188); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x76781c0>>
   |    |    | <UIImageView: 0x7680aa0; frame = (0 -34; 337 255); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x7680b00>>
   |    |    | <UILabel: 0x75b4bb0; frame = (282 157; 29 29); text = '132'; clipsToBounds = YES; alpha = 0.7; opaque = NO; autoresize = LM+TM; userInteractionEnabled = NO; layer = <CALayer: 0x75b4c40>>
   |    |    | <UIView: 0x75b5da0; frame = (14 41; 309 3); opaque = NO; autoresize = W+BM; layer = <CALayer: 0x75b5e00>>
   |    |    | <UIButton: 0x75b33e0; frame = (20 7; 64 30); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x75b34a0>>
   |    |    |    | <UIImageView: 0x719c910; frame = (0 0; 64 30); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x716f230>>
   |    |    |    | <UIButtonLabel: 0x75b37d0; frame = (12 7; 40 15); text = 'Cancel'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x75b3870>>
   |    |    | <UIButton: 0x75b3a60; frame = (265 7; 52 30); alpha = 0; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x75b3b20>>
   |    |    |    | <UIImageView: 0x767dc40; frame = (0 0; 52 30); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x76890a0>>
   |    |    |    | <UIButtonLabel: 0x75b3c20; frame = (6 7; 40 15); text = 'Cancel'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x75b3cc0>>
   |    |    | <UIButton: 0x75b3ef0; frame = (263 7; 54 30); opaque = NO; autoresize = LM+BM; layer = <CALayer: 0x75b3fb0>>
   |    |    |    | <UIImageView: 0x768f4f0; frame = (0 0; 54 30); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x768eb60>>
   |    |    |    | <UIButtonLabel: 0x75b40e0; frame = (12 7; 30 15); text = 'Send'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x75b4180>>
   |    |    | <UILabel: 0x75c6d40; frame = (139 5; 59 32); text = 'Tweet'; clipsToBounds = YES; opaque = NO; autoresize = W+BM; userInteractionEnabled = NO; layer = <CALayer: 0x75c6a10>>
   |    |    | <UIView: 0x7191800; frame = (14 43; 311 112); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x71952a0>>
   |    |    |    | <UITextView: 0x8227400; frame = (0 0; 311 112); text = 'NSString'; opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x75b6ff0>; layer = <CALayer: 0x75b6990>; contentOffset: {-0, 10}>
   |    |    |    |    | <UITextSelectionView: 0x75b6bf0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x75b6ca0>>
   |    |    |    |    | <UIImageView: 0x75b71e0; frame = (0 105; 217 7); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer: 0x75b7280>>
   |    |    |    |    | <UIImageView: 0x75b7320; frame = (304 70; 7 37); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer: 0x75b73c0>>
   |    |    |    |    | <UIWebDocumentView: 0x8227800; frame = (0 0; 311 45); text = 'NSString'; opaque = NO; userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x75bc490>; layer = <UIWebLayer: 0x75bb0d0>>
   |    |    |    |    |    | <TileHostLayer: 0x75bb770> (layer)
   |    |    |    |    |    |    | <TileLayer: 0x75c7270> (layer)
   |    |    |    |    | <UITextSelectionView: 0x75c6220; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x75c62a0>>
   |    |    |    |    |    | <UIView: 0x75a09b0; frame = (75 9; 3 24); alpha = 0; userInteractionEnabled = NO; layer = <CALayer: 0x75bde40>>
   |    |    |    |    | <UIView: 0x75b5f10; frame = (-1 41; 311 3); alpha = 0; opaque = NO; autoresize = W+BM; layer = <CALayer: 0x75b5f70>>
   |    |    |    |    | <UIView: 0x8a6ebc0; frame = (0 -216; 313 1); opaque = NO; layer = <CALayer: 0x8a6e750>>
   |    |    |    |    | <UIView: 0x8a6ec50; frame = (0 -188; 313 1); opaque = NO; layer = <CALayer: 0x8a6e600>>
   |    |    |    |    | <UIView: 0x8a6e630; frame = (0 -160; 313 1); opaque = NO; layer = <CALayer: 0x8a6e690>>
   |    |    |    |    | <UIView: 0x8a6e6c0; frame = (0 -132; 313 1); opaque = NO; layer = <CALayer: 0x8a6ecd0>>
   |    |    |    |    | <UIView: 0x8a6ed00; frame = (0 -104; 313 1); opaque = NO; layer = <CALayer: 0x8a6ed60>>
   |    |    |    |    | <UIView: 0x8a6ed90; frame = (0 -76; 313 1); opaque = NO; layer = <CALayer: 0x8a6edf0>>
   |    |    |    |    | <UIView: 0x8a6ee20; frame = (0 -48; 313 1); opaque = NO; layer = <CALayer: 0x8a6ee80>>
   |    |    |    |    | <UIView: 0x8a6ef10; frame = (0 -20; 313 1); opaque = NO; layer = <CALayer: 0x8a6eeb0>>
   |    |    |    |    | <UIView: 0x8a6ef70; frame = (0 8; 313 1); opaque = NO; layer = <CALayer: 0x8a6efd0>>
   |    |    |    |    | <UIView: 0x8a6f000; frame = (0 36; 313 1); opaque = NO; layer = <CALayer: 0x8a6f060>>
   |    |    |    |    | <UIView: 0x8a6f090; frame = (0 64; 313 1); opaque = NO; layer = <CALayer: 0x8a6f0f0>>
   |    |    |    |    | <UIView: 0x8a6f120; frame = (0 92; 313 1); opaque = NO; layer = <CALayer: 0x8a6f180>>
   |    |    |    |    | <UIView: 0x8a6f1b0; frame = (0 120; 313 1); opaque = NO; layer = <CALayer: 0x8a6f210>>
   |    |    |    |    | <UIView: 0x8a6f240; frame = (0 148; 313 1); opaque = NO; layer = <CALayer: 0x8a6f2a0>>
   |    |    | <UIImageView: 0x75b5110; frame = (251 43; 79 34); alpha = 0; autoresize = LM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x75b5170>>

基本上,这就是您所期望的:一堆背景图像、一个标签和按钮来伪造导航栏样式和一个大文本视图的内容。

于 2012-10-24T13:54:39.460 回答