Instantly share code, notes, and snippets.

Embed
What would you like to do?
Some users have requested a sample implementation to make a child viewcontroller showing a timeline of Tweets.
#import <TwitterKit/TwitterKit.h>
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor lightGrayColor];
// Standard TWTRTimelineViewController setup
TWTRUserTimelineDataSource *dataSource = [[TWTRUserTimelineDataSource alloc] initWithScreenName:@"StephenCurry30" APIClient:[[TWTRAPIClient alloc] init]];
TWTRTimelineViewController *timelineViewController = [[TWTRTimelineViewController alloc] initWithDataSource:dataSource];
// Standard parent-child view controller
[self addChildViewController:timelineViewController];
[self.view addSubview:timelineViewController.view];
[timelineViewController didMoveToParentViewController:self];
// Standard sizing
timelineViewController.view.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-150-[timeline]-150-|" options:0 metrics:nil views:@{@"timeline": timelineViewController.view}]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[timeline]|" options:0 metrics:nil views:@{@"timeline": timelineViewController.view}]];
}
@end
@shepting

This comment has been minimized.

Owner

shepting commented Jan 26, 2016

screenshot 2016-01-25 18 06 26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment