Commit ceef5261d94db1ed0d0f0a8d1ac41630399c00c7
1 parent
9d9cd5b045
Exists in
master
Implement tweet write view controller
Showing 1 changed file with 22 additions and 2 deletions Side-by-side Diff
TwitterKitExample/TWListViewController.m
View file @
ceef526
... | ... | @@ -60,13 +60,14 @@ |
60 | 60 | UIImage *image = [UIImage imageNamed:@"TwitterKitResources.bundle/twtr-icn-logo.png"]; |
61 | 61 | UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)]; |
62 | 62 | [button setImage:image forState:UIControlStateNormal]; |
63 | - [button addTarget:self action:@selector(moveToWrite) forControlEvents:UIControlEventTouchUpInside]; | |
63 | + [button addTarget:self action:@selector(moveToCompose) forControlEvents:UIControlEventTouchUpInside]; | |
64 | 64 | UIBarButtonItem *temp = [[UIBarButtonItem alloc] initWithCustomView:button]; |
65 | 65 | |
66 | 66 | NSArray *rightItemArray = @[temp |
67 | 67 | , [[UIBarButtonItem alloc] initWithTitle:@"타임라인" style:UIBarButtonItemStylePlain target:self action:@selector(moveToTimeline)]]; |
68 | 68 | [self.navigationItem setRightBarButtonItems:rightItemArray]; |
69 | 69 | |
70 | + [self addWriteViewController]; | |
70 | 71 | } |
71 | 72 | |
72 | 73 | - (void) moveToTimeline { |
73 | 74 | |
... | ... | @@ -74,9 +75,28 @@ |
74 | 75 | [self.navigationController pushViewController:vc animated:YES]; |
75 | 76 | } |
76 | 77 | |
77 | -- (void) moveToWrite { | |
78 | +- (void) moveToCompose { | |
78 | 79 | TWComposeViewController *vc = [[TWComposeViewController alloc] init]; |
79 | 80 | [self.navigationController pushViewController:vc animated:YES]; |
81 | +} | |
82 | + | |
83 | +- (void) moveToWrite { | |
84 | + TWTRSession *session = [Twitter sharedInstance].sessionStore.session; | |
85 | + | |
86 | + TWTRCardConfiguration *card = [TWTRCardConfiguration appCardConfigurationWithPromoImage:nil iPhoneAppID:@"12345" iPadAppID:nil googlePlayAppID:nil]; | |
87 | + TWTRComposerViewController *vc = [[TWTRComposerViewController alloc] initWithUserID:session.userID cardConfiguration:card]; | |
88 | + | |
89 | + vc.delegate = self; | |
90 | + | |
91 | + [self.navigationController presentViewController:vc animated:YES completion:nil]; | |
92 | +} | |
93 | + | |
94 | +- (void) addWriteViewController { | |
95 | + UIImage *image = [UIImage imageNamed:@"TwitterKitResources.bundle/twtr-icn-logo-white.png"]; | |
96 | + 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)]; | |
97 | + [tweetWriteButton setBackgroundImage:image forState:UIControlStateNormal]; | |
98 | + [tweetWriteButton addTarget:self action:@selector(moveToWrite) forControlEvents:UIControlEventTouchUpInside]; | |
99 | + [self.view addSubview:tweetWriteButton]; | |
80 | 100 | } |
81 | 101 | |
82 | 102 | - (void) congifureTableView:(CGRect) frame { |