【发布时间】:2010-02-25 20:01:38
【问题描述】:
我正在尝试让 Facebook Connect 功能在我的 iPhone 应用程序中运行。 我想知道如何在我的 UITableView 中正确排列按钮:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if (indexPath.section == 0){
if (indexPath.row == 0){
}
}
if (indexPath.section == 1){
if (indexPath.row == 0){
cell.textLabel.text = @"Connect with Facebook";
cell.accessoryView = login;
}
}
return cell;
只有当我点击单元格时才会显示该按钮。
如果可以的话请帮忙!
谢谢。
【问题讨论】:
-
您没有引用实例化并将按钮添加到表中的部分 - 还是在 InterfaceBuilder 中完成?
-
这是在 viewDidLoad 的代码中完成的: - (void)viewDidLoad { [super viewDidLoad]; login = [[[FBLoginButton alloc] init] autorelease]; }
-
好的,但我仍然看不到您如何将 FBLoginButton 的实例添加到您的表中。