您的位置:首页 > 其它

Protocol - 8

2015-09-11 12:02 411 查看
又找到一处炫酷使用委托的例子,所以说学习优秀的代码才是学习好玩之处!

if ([JSMessageInputView inputBarStyle] == JSInputBarStyleFlat)
    {
        sendButton = [UIButton buttonWithType:UIButtonTypeSystem];
    }
    else
    {
        sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
    }


进入inputBarStyle方法一看:

+ (JSInputBarStyle)inputBarStyle
{
    if ([__delegate respondsToSelector:@selector(inputBarStyle)])
        return [__delegate inputBarStyle];
    
    return JSInputBarStyleDefault;
}


代理部分:

static id<JSMessageInputViewDelegate> __delegate;


@protocol JSMessageInputViewDelegate <NSObject>

@optional
- (JSInputBarStyle)inputBarStyle;

@end


太牛逼了吧!炫酷之处在于旨在意会!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: