diff --git a/TwitterKitExample/TWListViewController.m b/TwitterKitExample/TWListViewController.m index b5755e7..e51f4f5 100644 --- a/TwitterKitExample/TWListViewController.m +++ b/TwitterKitExample/TWListViewController.m @@ -60,13 +60,14 @@ UIImage *image = [UIImage imageNamed:@"TwitterKitResources.bundle/twtr-icn-logo.png"]; UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)]; [button setImage:image forState:UIControlStateNormal]; - [button addTarget:self action:@selector(moveToWrite) forControlEvents:UIControlEventTouchUpInside]; + [button addTarget:self action:@selector(moveToCompose) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *temp = [[UIBarButtonItem alloc] initWithCustomView:button]; NSArray *rightItemArray = @[temp , [[UIBarButtonItem alloc] initWithTitle:@"타임라인" style:UIBarButtonItemStylePlain target:self action:@selector(moveToTimeline)]]; [self.navigationItem setRightBarButtonItems:rightItemArray]; + [self addWriteViewController]; } - (void) moveToTimeline { @@ -74,11 +75,30 @@ [self.navigationController pushViewController:vc animated:YES]; } -- (void) moveToWrite { +- (void) moveToCompose { TWComposeViewController *vc = [[TWComposeViewController alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } +- (void) moveToWrite { + TWTRSession *session = [Twitter sharedInstance].sessionStore.session; + + TWTRCardConfiguration *card = [TWTRCardConfiguration appCardConfigurationWithPromoImage:nil iPhoneAppID:@"12345" iPadAppID:nil googlePlayAppID:nil]; + TWTRComposerViewController *vc = [[TWTRComposerViewController alloc] initWithUserID:session.userID cardConfiguration:card]; + + vc.delegate = self; + + [self.navigationController presentViewController:vc animated:YES completion:nil]; +} + +- (void) addWriteViewController { + UIImage *image = [UIImage imageNamed:@"TwitterKitResources.bundle/twtr-icn-logo-white.png"]; + UIButton *tweetWriteButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - image.size.width*2 - 20, self.view.bounds.size.height - image.size.height*2 - 120, image.size.width*2, image.size.height*2)]; + [tweetWriteButton setBackgroundImage:image forState:UIControlStateNormal]; + [tweetWriteButton addTarget:self action:@selector(moveToWrite) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:tweetWriteButton]; +} + - (void) congifureTableView:(CGRect) frame { self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, frame.origin.y+frame.size.height+50