I’m trying to get Facebook Connect functionality working in my iPhone app.
I’m wondering how to get the button lined up correctly in my 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;
I’ve tried using the accessoryView, but it turns out like this:
Also the button only appears when if I tap on the cell.
Please help if you can!

The
accessoryViewis definitely going to be framed over to the right, since “accessory” generally refers to the little expando arrow widgets on the right of table cells that open up new pages, etc.You can have a lot of influence over the layout of the cell and position the FB button wherever you want if you add that button as a subview of the cell’s view. You should very definitely check out this sample project which demonstrates how to accomplish a whole slew of custom cell types.