2016-04-17 5 views
-1

私は学生です。私の英語は大変申し訳ありません。とても悪いです。 私は宿題があります。 私はOBJの-C を勉強しています私の質問カラオケのApp(レベル簡単) Buttons LOVE some musics (image here)どのように私はテーブルビューの愛/ unloveアイテムのボタンを作成することができます

Alert will show : Do you want to add this song to Tab bar : My Love Song(image here)

を作る:どのように私はテーブルビューに愛/ unloveの項目のボタンをレコード生成することができますか? 私を助けてください!ありがとう!

+0

を**? ;-) –

+0

これはここです:どのように私は愛のためのボタンを作成することができます/テーブルビューで項目をunlove:| –

+0

@カイルーああ、申し訳ありません、今私はそれを参照してください... –

答えて

1

たとえば、ときに、セットアップあなたの細胞を、その後、カスタムのUITableViewCellとセットアップ2つのボタンを作成:あなたの**質問what's

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    UITableViewCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuseIdentifier" forIndexPath:indexPath]; 

    // Configure the cell... 
    cell.likeToggleButton.selected = NO; //--> should be based on your settings 
    [cell.likeToggleButton addTarget:self action:@selector(toggleAction:) forControlEvents:UIControlEventTouchUpInside]; 

    return cell; 
} 


- (void)toggleActio:(UIButton *)sender { 

    UITableViewCell *cell = (UITableViewCell *)[sender.superview superview]; 
    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; 

    if (sender.selected) { 
     // perform your dislike action based on button indexPath 
     sender.selected = NO; 
    }else { 
     // perform your like action based on button indexPath 
     sender.selected = YES; 
    } 

} 
+0

仲間に感謝、私はそれを試してみましょう! –

関連する問題