關(guān)于delegate代理應(yīng)用場景的套路

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if (_delegate && [_delegate respondsToSelector:@selector(conversationListViewController:didSelectConversationModel:)]) {
        EaseConversationModel *model = [self.dataArray objectAtIndex:indexPath.row];
        [_delegate conversationListViewController:self didSelectConversationModel:model];
    } else {
        EaseConversationModel *model = [self.dataArray objectAtIndex:indexPath.row];
        EaseMessageViewController *viewController = [[EaseMessageViewController alloc] initWithConversationChatter:model.conversation.conversationId conversationType:model.conversation.type];
        viewController.title = model.title;
        [self.navigationController pushViewController:viewController animated:YES];
    }
}
@interface ConversationListController : EaseConversationListViewController
 self.delegate = self;

環(huán)信這里,父類的代理子類來實(shí)現(xiàn),直接self.delegate = self;

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1、在使用block前需要對(duì)block指針做判空處理 2.避免循環(huán)引用 block會(huì)飛內(nèi)部的所有對(duì)象引用計(jì)數(shù)加1,...
    大美象閱讀 812評(píng)論 0 1
  • 不是我考研,是學(xué)長學(xué)姐考研,但是我卻很有感觸,看她們這么拼,仿佛看到一年后的自己,也是別人同情的對(duì)象,也要經(jīng)歷這么...
    凡夫俗子Au閱讀 169評(píng)論 0 0
  • 夜市開始熱鬧 流連人潮,哼著你愛的歌謠 這種優(yōu)雅,并不是我想要 陌生人,能否坐下陪我聊聊 我們擦肩而過,錯(cuò)過了多少...
    過街閱讀 264評(píng)論 0 0
  • 股齡三年,仗著初生牛犢不怕虎,跳入了各種坑。 1.追漲 新手的第一次,運(yùn)氣總是很好。我買的第一支股票,從每股10漲...
    愛所有的一切閱讀 397評(píng)論 5 1
  • 堅(jiān)持看書寫書評(píng),只求可以培養(yǎng)自己獨(dú)立思考的能力。關(guān)于書本身,不求有人因我的書評(píng)選擇某書,只希望不要因?yàn)槲业臅u(píng)而拒...
    不想起名字的三公子閱讀 570評(píng)論 0 0

友情鏈接更多精彩內(nèi)容