Created
May 13, 2016 13:17
-
-
Save robbdimitrov/191b4bd1a86ad31962ee6e202007b6c4 to your computer and use it in GitHub Desktop.
Twitter doesn't allow setting text in TWTRConposerViewControlller, which is used for app cards. This is a simple hack to do just that.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CMTWTRConposerViewControlller.h | |
// ProtoSketch | |
// | |
// Created by Robert Dimitrov on 5/13/16. | |
// Copyright © 2016 Codemotion Ltd. All rights reserved. | |
// | |
#import <TwitterKit/TwitterKit.h> | |
@interface CMTWTRConposerViewControlller : TWTRComposerViewController | |
@property (nonatomic, readwrite, copy) NSString *tweetText; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CMTWTRConposerViewControlller.m | |
// ProtoSketch | |
// | |
// Created by Robert Dimitrov on 5/13/16. | |
// Copyright © 2016 Codemotion Ltd. All rights reserved. | |
// | |
#import "CMTWTRConposerViewControlller.h" | |
@implementation CMTWTRConposerViewControlller | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
for (UIView *subview in self.view.subviews) { | |
if ([subview respondsToSelector:@selector(textView)]) { | |
UITextView *textView = (UITextView *)[subview performSelector:@selector(textView)]; | |
if ([textView isKindOfClass:[UITextView class]]) { | |
textView.text = self.tweetText; | |
break; | |
} | |
} | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment