0.字符串拼接
NSString *str2 = @"";
for (NSUInteger i = 0 ; i < endCount ; i++) {
NSString *str = [NSString stringWithString:replacestr];
str2 = [str2 stringByAppendingString:str];
}
1.创建通知
[[NSNotificationCenter defaultCenter] postNotificationName:@"refreshzhuanzhuan" object:nil];
接收通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshzhuanData) name:@"refreshzhuanzhuan" object:nil];
移除通知
-(void)dealloc
{
[[NSNotificationCenter defaultCenter]removeObserver:@"通知方法名称"];
}
通知方法的实现
- (void)refreshzhuanData {
}
2.按钮的创建
UIButton *paiButton = [UIButton buttonWithType:UIButtonTypeCustom];
paiButton.frame = CGRectMake(0 ,45*SIZEH, mainScreenW, 110*SIZEH);
// [determineButton setImage:[UIImage imageNamed:@"queding.png"] forState:UIControlStateNormal];
paiButton.backgroundColor = [UIColor whiteColor];
paiButton.layer.cornerRadius = 110*SIZEH/2;
paiButton.titleLabel.font = [UIFont systemFontOfSize:14*SIZEW];
paiButton.titleLabel.textColor = mainWhiteColor;
[paiButton setTitle:@"下一步" forState:UIControlStateNormal];
[paiButton addTarget:self action:@selector(paiButtonClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:paiButton];
点击实现方法自己写吧
3.时间戳转换成字符串,一般是数据请求来的
CGFloat number =[_dataSource[indexPath.row][@"insert_time"] intValue];
NSInteger backnumber = number + 8*60*60;
NSString *str = [NSString stringWithFormat:@"%ld",(long)backnumber];
long long int date1 = (long long int)[str intValue];
NSDate *date2 = [NSDate dateWithTimeIntervalSince1970:date1];
NSString *str1 = [NSString stringWithFormat:@"%@",date2];
NSString *str2 = [str1 substringToIndex:20];
NSLog(@"%@",str2);
cell.secondLabel.text = str2
4.label的创建
_interestMoney = [[UILabel alloc] initWithFrame:CGRectMake(200 * sIZE, 13.5 * sIZE, 100 * sIZE, 20 * sIZE)];
_interestMoney.font = [UIFont systemFontOfSize:12 * sIZE];
_interestMoney.textAlignment = NSTextAlignmentRight;
_interestMoney.textColor = goldTextColor;
[self addSubview:self.interestMoney];
5.UIView的创建
UIView *line1 = [[UIView alloc]initWithFrame:CGRectMake(0, 48.5*sIZE, SCREEN_Width, 0.5*sIZE)];
line1.backgroundColor = applineColor;
[self addSubview:line1];
6.UItextFild的创建
_userTureNameText = [[UITextField alloc]initWithFrame:CGRectMake(70*SIZEW, 5*SIZEH, mainScreenW - 30 - 75*SIZEW, 20*SIZEH)];
_userTureNameText.placeholder = @"拍照后请核实身份信息";
_userTureNameText.textColor = [UIColor grayColor];
_userTureNameText.tag = 0;
_userTureNameText.textAlignment = NSTextAlignmentCenter;
//_userTureNameText.delegate = self;
_userTureNameText.keyboardType = UIKeyboardTypeDefault;//设置键盘类型
_userTureNameText.borderStyle = UITextBorderStyleRoundedRect;//设置边框
[View2 addSubview:_userTureNameText];
7.单击手势的点击
UITapGestureRecognizer* singleRecognizer = [[UITapGestureRecognizer alloc] init];
[singleRecognizer addTarget:self action:@selector(cancelBtnClick)];
//点击的次数
singleRecognizer.numberOfTapsRequired = 1; // 单击
//给self.view添加一个手势监测;
[_BGView addGestureRecognizer:singleRecognizer];