rap*_*tor 5 iphone xcode objective-c uitableview ios
我正在开发一个应用程序,用户可以将他们的应用程序的详细信息分享到Facebook.我有UITableview,其中包含作者姓名列表,当你点击书名时,它会转到另一个UITableView
,在那里它显示每个作者的不同书籍TableViewCell
.我可以在第二个显示列表UITableView
.我想知道如何分享作者姓名,书名和图像(第2张表格详情).我正在展示那样做的代码..因此,当用户想要分享细节时,他将不得不点击作者的UIButton
每个单元格中的哪个UITableView
.
didselectatindexpath
NSDictionary *selectedAuthor = nil;
NSArray *sectionArray=[mainIndexDictionary objectForKey:[allKeysArray objectAtIndex:indexPath.section]];
selectedAuthor = [sectionArray objectAtIndex:indexPath.row];
iPath=[[selectedAuthor objectForKey:@"SymptIndexID"] intValue];
NSLog(@"iPath - %d",iPath);
authortitleString=[[selectedAuthor objectForKey:@"authorIndexName"]stringByAppendingString:@" cure!"];
}
bookArray=[objDB customCellData:(NSInteger)iPath];
[self.view bringSubviewToFront:authorView];
[bookTableView scrollRectToVisible:CGRectMake(0.0, 0.0, 320.0,10.0) animated:NO];
[bookTableView reloadData]
;
Run Code Online (Sandbox Code Playgroud)
ume*_*yan 10
在ios 6.0中,您可以实现如下(您必须将社交框架添加到您的项目中)
#import <Social/Social.h>
- (void)ShareFacebook
{
SLComposeViewController *fbController=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){
[fbController dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs://"]];
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
}
break;
}};
[fbController setInitialText:@"This is My Sample Text"];
[fbController setCompletionHandler:completionHandler];
[self presentViewController:fbController animated:YES completion:nil];
}
else{
UIAlertView *alert = [[[UIAlertView alloc]initWithTitle:@"Sign in!" message:@"Please first Sign In!" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil]autorelease];
[alert show];
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8744 次 |
最近记录: |