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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
shepting commentedJan 26, 2016