0

I want to change cursor position in textview of SLComposeViewController to beginning of UITextView currently is show me the end of initial Text: Currently Cursor

but I want cursor at first position in UITextView. with (iOS 9 support) I also use this code

    [self presentViewController:sharingComposer animated:NO completion:^{
        for (UIView *viewLayer1 in sharingComposer.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];
                            sharingTextView = (UITextView *)viewLayer3;
                        }
                    }
                }
            }
        }
    }];

but i can't get sharing UITextView and not working for me.

Nirav Hathi
  • 1,507
  • 3
  • 12
  • 20

1 Answers1

0

Try this:-

UITextPosition *beginning = [sharingTextView beginningOfDocument];
[sharingTextView setSelectedTextRange:[textField textRangeFromPosition:beginning
                                                      toPosition:beginning]];
pkc456
  • 8,350
  • 38
  • 53
  • 109