二卡八不显示离线,背包礼物一键全送增加提示
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#import "QXPayTypeModel.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXDynamicNetwork.h"
|
||||
#import "QXCustomAlertView.h"
|
||||
|
||||
|
||||
@interface QXSendGiftView()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate,QXMenuPopViewDelegate,UIGestureRecognizerDelegate>
|
||||
@@ -354,6 +355,19 @@
|
||||
showToast(@"一键全送仅能选择一个用户");
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
QXCustomAlertView *alertView = [[QXCustomAlertView alloc] init];
|
||||
alertView.cancelBlock = ^{
|
||||
|
||||
};
|
||||
alertView.commitBlock = ^{
|
||||
[weakSelf sendAllNetWork];
|
||||
};
|
||||
[alertView showInView:self.vc.view title:@"温馨提示" message:@"是否确认将背包礼物全部送出" cancleTitle:nil commitTitle:nil];
|
||||
|
||||
}
|
||||
// 一键清空网络请求
|
||||
-(void)sendAllNetWork{
|
||||
NSString *userId = [self.pitUserListView.selectedArray componentsJoinedByString:@","];
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomBagGiftClearWithRoomId:self.roomId userId:userId heartId:self.heartId auction_id:self.auctionId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
QXLOG(@"========首页子控制器即将展示========");
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.page = 1;
|
||||
[self.view addSubview:self.collectionView];
|
||||
@@ -48,24 +52,28 @@
|
||||
[super viewDidAppear:animated];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
-(void)setRoomType:(QXMyRoomType *)roomType{
|
||||
_roomType = roomType;
|
||||
[self getRoomList];
|
||||
}
|
||||
- (void)getRoomList {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
// __weak typeof(self)weakSelf = self;
|
||||
@weakify(self)
|
||||
[QXHomePageNetwork homeRoomListWithPage:self.page is_top:NO label_id:self.roomType.id successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
@strongify(self)
|
||||
if (self.page == 1) {
|
||||
[self.dataArray removeAllObjects];
|
||||
}
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.collectionView reloadData];
|
||||
[self.dataArray addObjectsFromArray:list];
|
||||
[self.collectionView reloadData];
|
||||
if (list.count == 0) {
|
||||
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
self.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[weakSelf.collectionView.mj_footer endRefreshing];
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
@strongify(self)
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}];
|
||||
}
|
||||
@@ -113,10 +121,12 @@
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXHomeRoomCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXHomeRoomCell"];
|
||||
MJWeakSelf
|
||||
// MJWeakSelf
|
||||
@weakify(self)
|
||||
_collectionView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getRoomList];
|
||||
@strongify(self)
|
||||
self.page++;
|
||||
[self getRoomList];
|
||||
}];
|
||||
}
|
||||
return _collectionView;
|
||||
|
||||
@@ -121,11 +121,13 @@
|
||||
self.categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
|
||||
self.pagingView.listContainerView.listCellBackgroundColor = [UIColor clearColor];
|
||||
// [self performSelector:@selector(giftScrollViewShow) afterDelay:5];
|
||||
MJWeakSelf
|
||||
// MJWeakSelf
|
||||
@weakify(self)
|
||||
self.pagingView.mainTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
[weakSelf requestSlideToolData];
|
||||
[weakSelf getTopRoomList];
|
||||
[weakSelf getBanner];
|
||||
@strongify(self)
|
||||
[self requestSlideToolData];
|
||||
[self getTopRoomList];
|
||||
[self getBanner];
|
||||
}];
|
||||
|
||||
self.firstRechargeBtn.hidden = YES;
|
||||
@@ -151,26 +153,28 @@
|
||||
[self getBanner];
|
||||
}
|
||||
- (void)requestSlideToolData {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
@weakify(self)
|
||||
[QXHomePageNetwork homeRoomLabelListsuccessBlock:^(NSArray<QXMyRoomType *> * _Nonnull list) {
|
||||
[weakSelf.titles removeAllObjects];
|
||||
@strongify(self)
|
||||
[self.titles removeAllObjects];
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
[weakSelf.titles addObjectsFromArray:list];
|
||||
[self.titles addObjectsFromArray:list];
|
||||
for (QXMyRoomType *md in list) {
|
||||
[arr addObject:md.label_name];
|
||||
}
|
||||
weakSelf.categoryView.titles = arr;
|
||||
[weakSelf.categoryView reloadData];
|
||||
[weakSelf.pagingView.mainTableView.mj_header endRefreshing];
|
||||
self.categoryView.titles = arr;
|
||||
[self.categoryView reloadData];
|
||||
[self.pagingView.mainTableView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.pagingView.mainTableView.mj_header endRefreshing];
|
||||
[self.pagingView.mainTableView.mj_header endRefreshing];
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getFirstRechargePermission{
|
||||
MJWeakSelf
|
||||
@weakify(self)
|
||||
[QXHomePageNetwork getFirstRechargePermissionSuccessBlock:^(BOOL isShow) {
|
||||
weakSelf.firstRechargeBtn.hidden = !isShow;
|
||||
@strongify(self)
|
||||
self.firstRechargeBtn.hidden = !isShow;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
@@ -183,7 +187,7 @@
|
||||
// [v showInView:self.view];
|
||||
}
|
||||
-(void)popFirstRechargeView{
|
||||
MJWeakSelf
|
||||
// MJWeakSelf
|
||||
// view.giftArray = @[@"",@"",@"",@"",@"",@""];
|
||||
self.firstRechargeView.closeActionBlock = ^{
|
||||
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
||||
@@ -267,33 +271,35 @@
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.roomId isRejoin:NO navagationController:self.navigationController];
|
||||
}
|
||||
- (void)getTopRoomList {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
@weakify(self)
|
||||
[QXHomePageNetwork homeRoomListWithPage:0 is_top:YES label_id:@"" successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
@strongify(self)
|
||||
[self.dataArray removeAllObjects];
|
||||
[self.dataArray addObjectsFromArray:list];
|
||||
if (isAppStore) {
|
||||
self.appStoreView.hidden = NO;
|
||||
}else{
|
||||
self.appStoreView.hidden = YES;
|
||||
}
|
||||
// weakSelf.appStoreView.dataArray = list;
|
||||
[weakSelf.cycleScrollView reloadData];
|
||||
[self.cycleScrollView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)getBanner{
|
||||
MJWeakSelf
|
||||
@weakify(self)
|
||||
[QXHomePageNetwork homeBannerSuccessBlock:^(NSArray<QXBanner *> * _Nonnull list) {
|
||||
@strongify(self)
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
for (QXBanner *banner in list) {
|
||||
[arr addObject:banner.image];
|
||||
}
|
||||
[weakSelf.bannerArry removeAllObjects];
|
||||
[weakSelf.bannerArry addObjectsFromArray:list];
|
||||
weakSelf.appStoreView.bannerArray = list;
|
||||
weakSelf.bannerScrollView.imageURLStringsGroup = arr;
|
||||
[self.bannerArry removeAllObjects];
|
||||
[self.bannerArry addObjectsFromArray:list];
|
||||
self.appStoreView.bannerArray = list;
|
||||
self.bannerScrollView.imageURLStringsGroup = arr;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
@@ -505,4 +511,7 @@
|
||||
}
|
||||
return _appStoreView;
|
||||
}
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface QXDirectSetScaleView : UIView
|
||||
@property (nonatomic,strong)NSString *userId;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
|
||||
/// 转币
|
||||
@property (nonatomic,assign)BOOL isGiveCoin;
|
||||
|
||||
/// 头条
|
||||
|
||||
@@ -39,6 +39,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 麦位视图类型
|
||||
@property (nonatomic,assign)QXRoomSeatContentViewType type;
|
||||
|
||||
/// 是否展示离线状态 需求暂定二卡八不展示离线状态
|
||||
@property (nonatomic,assign)BOOL noOffLine;
|
||||
|
||||
//@property (nonatomic,strong)QXRoomOwnerModel *userModel ;
|
||||
|
||||
-(void)updateUserCharm:(NSString*)charm;
|
||||
|
||||
@@ -197,6 +197,9 @@
|
||||
}
|
||||
|
||||
-(void)onlineStatusDidChanged:(NSNotification*)notice{
|
||||
if (self.noOffLine) {
|
||||
return;
|
||||
}
|
||||
NSDictionary *parm = notice.object;
|
||||
NSString *uid = [NSString stringWithFormat:@"%@",[parm objectForKey:@"user_id"]];
|
||||
BOOL isOnline = [[parm objectForKey:@"is_online"] boolValue];
|
||||
@@ -232,6 +235,9 @@
|
||||
[self stopAudioAnimation];
|
||||
}
|
||||
}
|
||||
-(void)setNoOffLine:(BOOL)noOffLine{
|
||||
_noOffLine = noOffLine;
|
||||
}
|
||||
-(void)setIsPK:(BOOL)isPK{
|
||||
_isPK = isPK;
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:10];
|
||||
@@ -365,7 +371,11 @@
|
||||
if (pitModel.user_id.longValue > 0) {
|
||||
BOOL is_offline = [[[QXGlobal shareGlobal].offLineDict objectForKey:pitModel.user_id?pitModel.user_id:@"0"] boolValue];
|
||||
if (is_offline) {
|
||||
self.offlineImageView.hidden = NO;
|
||||
if (self.noOffLine) {
|
||||
self.offlineImageView.hidden = YES;
|
||||
}else{
|
||||
self.offlineImageView.hidden = NO;
|
||||
}
|
||||
}else{
|
||||
self.offlineImageView.hidden = YES;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ static NSInteger maxSeat = 8;
|
||||
for (int i = 0 ; i < maxSeat ; i++) {
|
||||
QXRoomSeatContentView *contentView = [[QXRoomSeatContentView alloc] init];
|
||||
contentView.number = i+1;
|
||||
contentView.noOffLine = YES;
|
||||
// [contentView addTapBlock:^(id _Nonnull obj) {
|
||||
// [weakSelf didClickSeatView:obj];
|
||||
// }];
|
||||
@@ -88,6 +89,8 @@ static NSInteger maxSeat = 8;
|
||||
}
|
||||
[self.seatArray addObject:self.compereView];
|
||||
[self.seatArray addObject:self.guestView];
|
||||
self.compereView.noOffLine = YES;
|
||||
self.guestView.noOffLine = YES;
|
||||
}
|
||||
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fzl-QL-ad0">
|
||||
<rect key="frame" x="101" y="40" width="244" height="17"/>
|
||||
<rect key="frame" x="101" y="40" width="35.333333333333343" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -47,13 +47,13 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="33" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M4J-MV-C6I">
|
||||
<rect key="frame" x="383" y="40" width="55" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="55" id="Y5D-hq-2Hl"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="55" id="Y5D-hq-2Hl"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Vector" translatesAutoresizingMaskIntoConstraints="NO" id="6vu-N8-8uU">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_hot_icon" translatesAutoresizingMaskIntoConstraints="NO" id="6vu-N8-8uU">
|
||||
<rect key="frame" x="355" y="38.666666666666664" width="20" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="20" id="RPP-W2-uG7"/>
|
||||
@@ -66,7 +66,6 @@
|
||||
<constraint firstItem="fzl-QL-ad0" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="6qM-F0-kaU"/>
|
||||
<constraint firstItem="A6u-gx-qxe" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="KTD-SJ-b98"/>
|
||||
<constraint firstItem="fzl-QL-ad0" firstAttribute="leading" secondItem="HlF-Pn-DKh" secondAttribute="trailing" constant="16" id="KTy-bw-0M9"/>
|
||||
<constraint firstItem="6vu-N8-8uU" firstAttribute="leading" secondItem="fzl-QL-ad0" secondAttribute="trailing" constant="10" id="KfJ-GU-xhc"/>
|
||||
<constraint firstItem="HlF-Pn-DKh" firstAttribute="leading" secondItem="A6u-gx-qxe" secondAttribute="trailing" constant="10" id="QEi-Df-wpG"/>
|
||||
<constraint firstItem="HlF-Pn-DKh" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="UMC-XC-UHT"/>
|
||||
<constraint firstItem="6vu-N8-8uU" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="Wg4-GR-Vo4"/>
|
||||
@@ -86,7 +85,7 @@
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="Vector" width="14" height="14"/>
|
||||
<image name="user_header_placehoulder" width="128" height="128"/>
|
||||
<image name="room_hot_icon" width="16" height="16"/>
|
||||
<image name="user_header_placehoulder" width="60" height="60"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -255,10 +255,14 @@
|
||||
}
|
||||
}
|
||||
-(void)applicationDidEnterBackground:(UIApplication *)application{
|
||||
QXLOG(@"========app已经进入后台========");
|
||||
if ([QXGlobal.shareGlobal.roomId isExist]) {
|
||||
[[QXGiftPlayerManager shareManager] stopPlay];
|
||||
}
|
||||
}
|
||||
-(void)applicationWillResignActive:(UIApplication *)application{
|
||||
QXLOG(@"========app即将进入后台========");
|
||||
}
|
||||
-(void)applicationWillEnterForeground:(UIApplication *)application{
|
||||
if ([QXGlobal.shareGlobal.roomId isExist] && (QXGlobal.shareGlobal.miniView==nil)) {
|
||||
[[QXGiftPlayerManager shareManager] startPlay];
|
||||
|
||||
18
QXLive/Tabbar/弹窗/QXCustomAlertView.h
Normal file
18
QXLive/Tabbar/弹窗/QXCustomAlertView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXCustomAlertView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/10.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXCustomAlertView : UIView
|
||||
@property (nonatomic,copy)void(^commitBlock)(void);
|
||||
@property (nonatomic,copy)void(^cancelBlock)(void);
|
||||
-(void)showInView:(UIView *)view title:(NSString*)title message:(NSString*)message cancleTitle:(NSString*)cancleTitle commitTitle:(NSString*)commitTitle;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
134
QXLive/Tabbar/弹窗/QXCustomAlertView.m
Normal file
134
QXLive/Tabbar/弹窗/QXCustomAlertView.m
Normal file
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// QXCustomAlertView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/10.
|
||||
//
|
||||
|
||||
#import "QXCustomAlertView.h"
|
||||
@interface QXCustomAlertView()
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *cancelBtn;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@end
|
||||
|
||||
@implementation QXCustomAlertView
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(300))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
self.bgView.layer.masksToBounds = YES;
|
||||
self.bgView.layer.cornerRadius = 16;
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.text = QXText(@"温馨提示");
|
||||
self.titleLabel.textColor = RGB16(0x333333);
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.bgView);
|
||||
make.top.equalTo(self.bgView).offset(16);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
// self.messageLabel.text = QXText(@"您确定要清空背包吗?");
|
||||
self.messageLabel.textColor = RGB16(0x000000);
|
||||
self.messageLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
[self.bgView addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgView).offset(16);
|
||||
make.right.equalTo(self.bgView).offset(-16);
|
||||
make.centerY.equalTo(self.bgView);
|
||||
}];
|
||||
|
||||
|
||||
self.commitBtn = [[UIButton alloc] init];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(ScaleWidth(110));
|
||||
make.right.mas_equalTo(-20);
|
||||
}];
|
||||
|
||||
|
||||
self.cancelBtn = [[UIButton alloc] init];
|
||||
[self.cancelBtn addRoundedCornersWithRadius:21];
|
||||
self.cancelBtn.backgroundColor = RGB16(0xF3F3F3);
|
||||
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.cancelBtn];
|
||||
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(ScaleWidth(110));
|
||||
make.left.mas_equalTo(20);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)cancelAction{
|
||||
if (self.cancelBlock) {
|
||||
self.cancelBlock();
|
||||
}
|
||||
[self hide];
|
||||
}
|
||||
-(void)commitAction{
|
||||
if (self.commitBlock) {
|
||||
self.commitBlock();
|
||||
}
|
||||
[self hide];
|
||||
}
|
||||
-(void)showInView:(UIView *)view title:(NSString *)title message:(NSString *)message cancleTitle:(NSString *)cancleTitle commitTitle:(NSString *)commitTitle{
|
||||
if ([title isExist]) {
|
||||
self.titleLabel.text = title;
|
||||
}
|
||||
if ([message isExist]) {
|
||||
self.messageLabel.text = message;
|
||||
}
|
||||
if (cancleTitle) {
|
||||
[self.cancelBtn setTitle:cancleTitle forState:(UIControlStateNormal)];
|
||||
}
|
||||
if (commitTitle) {
|
||||
[self.commitBtn setTitle:cancleTitle forState:(UIControlStateNormal)];
|
||||
}
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(362))/2.0;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user