lundi 2 mars 2015

How to a share link in twitter with out set up in iphone settings page?

i want to share a link in twitter. At the time click on twitter button share a link.But first time click on twitter button i want to show twitter login to share in that page only no need to go in iphone settings page


enter image description here


My code is



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!");
}
}];
}



Aucun commentaire:

Enregistrer un commentaire