我想在twitter上分享一个链接。当时点击twitter按钮分享一个链接。但是第一次点击twitter按钮我要显示twitter登录才能在该页面分享,只需要进入iphone设置页面
我的代码是
UIButton *twitterBtn=[[UIButton alloc]initWithFrame:CGRectMake(50,100, 50, 50)];
[twitterBtn setImage:[UIImage imageNamed:@"Twitter-icon.png"] forState:UIControlStateNormal];
[twitterBtn addTarget:self action:@selector(twitterBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:twitterBtn];
-(void)twitterBtnClicked:(UIButton *)sender
{
NSString *link=@"http://myWebpage.com";
TWTRComposer *composer = [[TWTRComposer alloc] init];
[composer setText:[NSString stringWithFormat:@"%@,%@ ....", [itemDetailsDict objectForKey:@"name"],link]];
[composer setImage:[UIImage imageNamed:@"fabric"]];
[composer showWithCompletion:^(TWTRComposerResult result) {
if (result == TWTRComposerResultCancelled) {
NSLog(@"Tweet composition cancelled");
}
else {
NSLog(@"Sending Tweet!");
}
}];
}