2016年01月07日会社プロジェクト開発記録
2261 ワード
2016年01月07日14:35:00木曜
forループButtonの作成方法
後で呼び出すとき
左側のカスタムtextfieldを設定する
もっとすばらしい文章は、私の公衆番号に尽きています.
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;
もっとすばらしい文章は、私の公衆番号に尽きています.