随笔 - 400,  文章 - 0,  评论 - 7,  阅读 - 21万

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * 设定右侧按钮方法
 */
- (void)createMakeBtn{
    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 70, 40)];
    button.backgroundColor = UIColor.systemGreenColor;
    self.makeBtn = button;
    button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [button.titleLabel setFont:[UIFont systemFontOfSize:14 weight:(UIFontWeightRegular)]];
    [button addTarget:self action:@selector(clickMakeBtn) forControlEvents:UIControlEventTouchUpInside];
    button.userInteractionEnabled = NO;
    button.showsTouchWhenHighlighted = NO;
    ///显示的item
    UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:button];
    ///间距
    UIBarButtonItem *fixItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    self.navigationItem.rightBarButtonItems = @[fixItem, item];
     
    [self updateCreateBtnStatus];
}
 
/// 更新制作按钮的显示状态
- (void)updateCreateBtnStatus{
    if (self.selectedAssetArr.count > 0) {
        self.makeBtn.backgroundColor = UIColor.blueColor;
        self.makeBtn.userInteractionEnabled = YES;
    }else{
        self.makeBtn.backgroundColor = UIColor.grayColor;
        self.makeBtn.userInteractionEnabled = NO;
    }
    NSString *selectedStr = [NSString stringWithFormat:@"制作(%lu/%d)", (unsigned long)self.selectedAssetArr.count, self.maxSelectedPic];
    [self.makeBtn setTitle:selectedStr forState:(UIControlStateNormal)];
}

  

posted on   懂事长qingzZ  阅读(304)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2019-11-26 Swift - UITableView 的自定义cell, 区头和自定义区尾 VFL约束报错问题
2018-11-26 swift - 全屏imageView的适配 - UIViewContentMode选择

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示