2016年01月07日公司项目开发记录

2016年01月07日14:35:00 周四

for 循环创建 Button 如何区分

_actionButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _actionButton.frame = healthView.frame;
        [_actionButton addTarget:self action:@selector(actionButton:) forControlEvents:(UIControlEventTouchUpInside)];
        _actionButton.tag = 100 + i;
        [_actionButton setTitle:@"" forState:(UIControlStateNormal)];
        [_backScrollView addSubview:_actionButton];

之后调用的时候

-(void)actionButton:(UIButton *)button{

    switch (button.tag) {
        case 100:{
            NSLog(@"血压  BP");
          }
            break;
        case 101:{
            NSLog(@"血糖  BG");
          }
            break;
        case 102:{
            NSLog(@"血脂  FA");
          }
            break;

        default:
            break;
    }
}



设置左侧自定义的 textfield

//设置用户名输入框
    _userName_TF = [[UITextField alloc]initWithFrame:CGRectMake(-3,CGRectGetMaxY( userLogo_Image.frame) + 15*SKHeightRate, SKScreenWidth+6, 46*SKHeightRate)];
    _userName_TF.placeholder = @"请输入用户名";
    _userName_TF.borderStyle = UITextBorderStyleRoundedRect;
    _userName_TF.keyboardType = UIKeyboardTypeURL;
    _userName_TF.userInteractionEnabled = YES;
    _userName_TF.font = [UIFont fontWithName:@"Arial" size:14];
    _userName_TF.delegate = self;
    _userName_TF.layer.borderWidth = 1;
    _userName_TF.layer.borderColor = [RGB(204, 204, 204) CGColor];
    _userName_TF.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    [self.view addSubview:_userName_TF];

    UIView *viewName = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 64*SKWidthRate, 46*SKHeightRate)];
    viewName.backgroundColor = [UIColor clearColor];
    UIImageView *userNameView = [[UIImageView alloc]initWithFrame:CGRectMake(30*SKWidthRate, 10*SKHeightRate, 20*SKHeightRate, 26*SKHeightRate)];
    userNameView.image = [[UIImage imageNamed:@"手机"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [viewName addSubview:userNameView];
    _userName_TF.leftView = viewName;
   _userName_TF.leftViewMode = UITextFieldViewModeAlways;


更多精彩文章,尽在我的公众号.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值