2

I am trying to get the UITextView of SLComposeViewController, how do I get it? I tried the following but it doesn't work:

  [viewController presentViewController:facebookController
           animated:YES
           completion:^{
               for (UIView *viewLayer1 in facebookController.view.subviews) {
                   for (UIView *viewLayer2 in viewLayer1.subviews) {
                       if ([viewLayer2 isKindOfClass:[UIView class]]) {
                           for (UIView *viewLayer3 in viewLayer2.subviews) {
                               if ([viewLayer3 isKindOfClass:[UITextView class]]) {
                                   [(UITextView *)viewLayer3 setDelegate:self];

                               }
                           }
                       }
                   }
               }               }];

FYI the code above works fine if it's a SLServiceTypeTwitter but it doesn't work if it's SLServiceTypeFacebook

adit
  • 32,574
  • 72
  • 229
  • 373

1 Answers1

1

It looks like 0x7fffffff managed to get it in this answer: https://stackoverflow.com/a/13737046/189804

Note his note: "Important: Please note that the above will only work if placed in the completion handler."

Community
  • 1
  • 1
Adam Eberbach
  • 12,309
  • 6
  • 62
  • 114
  • I had copied the same exact code in his post but it didn't work. If you notice the code above is the same – adit May 08 '13 at 00:45
  • I did notice that, are you using it in the completion handler? – Adam Eberbach May 08 '13 at 00:46
  • Yes I did.. I just noticed that the above code works for twitter but not for facebook – adit May 08 '13 at 00:50
  • Haha, unfortunately I didn't notice until after that post, that this code only works for SLServiceTypeTwitter. Facebook, and Weibo apparently have completely difference view hierarchies. – Mick MacCallum May 09 '13 at 17:45