Crayon Coding
Friday, April 8, 2011
Tuesday, February 15, 2011
iPhone sdk facebook twitter sharing integrate very easily in your app.
- SystemConfiguration.framework
- Security.framework
- MessageUI.framework
-(IBAction)shareOnTwitter
{
UIImage *image=[UIImage imageNamed:@"Default.png"];
SHKItem *item = [SHKItem image:image title:nil];
twitterController = [[SHKTwitter alloc]init];
twitterController.item = item;
if ([twitterController isAuthorized])
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Already Logged In" delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:@"Logout"
otherButtonTitles:@"Upload",nil];
actionSheet.tag = 40;//facbook
[actionSheet showInView:self.view];
[actionSheet release];
}
else
{
[twitterController share];
}
}
-(IBAction)shareOnfacebook
{
UIImage *image = [self getImage];
SHKItem *item = [SHKItem image:image title:@"Birthday eCards"];
fbController = [[SHKFacebook alloc]init];
fbController.item = item;
if ([fbController isAuthorized])
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:str
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:@"Logout"
otherButtonTitles:@"Upload",nil];
actionSheet.tag = 20;//facbook
[actionSheet showInView:self.view];
[actionSheet release];
}
else
{
[fbController share];
}
}
}
#pragma mark -
#pragma mark actionSheet delegate Methods
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (actionSheet.tag == 20)//facebook
{
if (buttonIndex == 0)
{
[SHKFacebook logout];
[fbController share];
}
else if(buttonIndex == 1)
{
[fbController share];
}
}
if (actionSheet.tag == 40)//twitter
{
if (buttonIndex == 0)
{
[SHKTwitter logout];
}
else if(buttonIndex == 1)
{
[twitterController share];
}
}
}