房间榜单完成
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// XPRoomFunctionContainerView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/15.
|
||||
//
|
||||
|
||||
#import "XPRoomFunctionContainerView.h"
|
||||
///Tool
|
||||
#import "XPMacro.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
///View
|
||||
#import "XPRoomRankViewController.h"
|
||||
@interface XPRoomFunctionContainerView ()
|
||||
///host 代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
||||
///房间榜
|
||||
@property (nonatomic,strong) UIButton *contributionButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomFunctionContainerView
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.delegate = delegate;
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.contributionButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.contributionButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(-12);
|
||||
make.top.mas_equalTo(statusbarHeight+57);
|
||||
make.width.mas_equalTo(90);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)contributionButtonAction:(UIButton *)sender {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||
XPRoomRankViewController * rankVC = [[XPRoomRankViewController alloc] initWithRoomUid:roomUid delegate:self.delegate];
|
||||
[self.delegate.getCurrentNav presentViewController:rankVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIButton *)contributionButton {
|
||||
if (!_contributionButton) {
|
||||
_contributionButton = [[UIButton alloc]init];
|
||||
[_contributionButton addTarget:self action:@selector(contributionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_contributionButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
|
||||
[_contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
|
||||
[_contributionButton setImage:[UIImage imageNamed:@"room_rank_enter_icon"] forState:UIControlStateNormal];
|
||||
[_contributionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_contributionButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
_contributionButton.layer.cornerRadius = 13;
|
||||
_contributionButton.layer.masksToBounds = YES;
|
||||
_contributionButton.imageEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
|
||||
_contributionButton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
|
||||
}
|
||||
return _contributionButton;
|
||||
}
|
||||
@end
|
Reference in New Issue
Block a user