ios常用的快捷代码CodeSnieept

更新时间:2023-07-08 07:49:30 阅读: 评论:0

ios常⽤的快捷代码CodeSnieept
/*
---PString
@property(nonatomic,copy)NSString *
---动态增加cell
[_tempArr addObject:@"认捐物资"];
NSArray * indexPaths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:_unt-1 inSection:1]];
[lf.gc_tableView beginUpdates];
[lf.gc_tableView inrtRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationLeft];
[lf.gc_tableView endUpdates];
---关闭侧滑,防⽌出现bug
id traget = lf.navigationController.interactivePopGestureRecognizer.delegate;
UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];
[lf.view addGestureRecognizer:pan];傅昌波
---计算⾼度
村晚CGRect contentRect1 =[markModel.briefing boundingRectWithSize:CGSizeMake(SCREEN_WIDTH-93, MAXFLOAT) options:NSStringDrawingUsFontLeading|NSStringDr ---图⽚适配
_tMode = UIViewContentModeScaleAspectFill;
_image.clipsToBounds = YES;
---推出到指定控制器
for (UIViewController *controller in lf.navigationController.viewControllers) {
if ([controller isKindOfClass:[AViewController class]]) {
AViewController *A =(AViewController *)controller;
[lf.navigationController popToViewController:A animated:YES];
---系统Cell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"mineCell"];
if (!cell) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuIdentifier:@"mineCell"];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
cell.backgroundColor=[QCColor white];
cell.lectionStyle=UITableViewCellSelectionStyleNone;
}
[cell tSeparatorInt:UIEdgeIntsMake(0, 0, 0, 0)];
cell.imageView.image=[UIImage imageNamed:[NSString stringWithFormat:@"me_%@",_w]]];
<=_w];
return cell;
---指定cell刷新
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:0 inSection:0];
[lf.gc_tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
---指定Section刷新
NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];美团外卖好评
[lf.gc_tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
---⽤户协议与隐私协议
UITextView *contentTV = [[UITextView alloc] init];
contentTV.font = FONT(10);
//不要忘记设置frame!
剖切面NSString *descText = @"登录即表⽰您已详细阅读并同意《中国移动认证服务条款》,开⼼果园《⽤户协议》与《隐私协议》";
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:descText];
//设置被点击字体颜⾊
contentTV.linkTextAttributes = @{NSForegroundColorAttributeName:RGB(255, 150, 102)};
[attributedString addAttribute:NSLinkAttributeName
value:@"ProvidentFundshuaxin://"
range:[descText rangeOfString:@"《中国移动认证服务条款》"]];
[attributedString addAttribute:NSLinkAttributeName
value:@"yonghuxieyi://"
range:[descText rangeOfString:@"《⽤户协议》"]];
[attributedString addAttribute:NSLinkAttributeName
value:@"yinsixieyi://"
range:[descText rangeOfString:@"《隐私协议》"]];
contentTV.attributedText = attributedString;
contentTV.delegate = lf;
contentTV.editable = NO;        //必须禁⽌输⼊,否则点击将弹出输⼊键盘
contentTV.scrollEnabled = NO;
[lf.view addSubview:contentTV];
[contentTV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(lf.view.mas_left).offt(30);
make.width.mas_equalTo(SCREEN_WIDTH-60);
make.bottom.mas_equalTo(lf.view.mas_bottom).offt(-30);
make.height.mas_equalTo(50);
}];
}
#pragma mark ---- textView Delegate ----
-(BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange{
if ([[URL scheme] isEqualToString:@"ProvidentFundshuaxin"]) {
NSLog(@"富⽂本点击服务条款");
}el if ([[URL scheme] isEqualToString:@"yonghuxieyi"]) {
NSLog(@"富⽂本点击隐私政策");
}
el if ([[URL scheme] isEqualToString:@"yinsixieyi"]) {
NSLog(@"富⽂本点击隐私政策");
}
return YES;
色表妹
}
---指定圆⾓
CGFloat radius = 15;
UIRectCorner corner = UIRectCornerBottomRight|UIRectCornerBottomLeft; // 右上右左举例
if (@available(iOS 11.0,*)) { // iOS11以上苹果提供了属性
_Radius = radius;
_upView.layer.maskedCorners = (CACornerMask)corner;
}el{ // iOS11已下⽤UIBezierPath设置
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:_upView.bounds byRoundingCorners:corner cornerRadii:CGSizeMake(radius, radius)];    CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init];
maskLayer.frame = _upView.bounds;
maskLayer.path = path.CGPath;
_upView.layer.mask = maskLayer;
}
---⾃定义cell
static NSString *identifier = @"ArticlePricingCell";
ArticlePricingCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil){
cell = [[ArticlePricingCell alloc] initWithStyle:UITableViewCellStyleDefault reuIdentifier:identifier];
}
---unt != 0
if (partArr != nil && ![partArr isKindOfClass:[NSNull class]] && unt != 0)
{
}
---Arr转String
[nameArr componentsJoinedByString:@","]数学家的故事
---ArrayModel
---ArrayModel
[lf.dataList addObjectsFromArray:[NewsListDetailModel mj_objectArrayWithKeyValuesArray:data]];
---DicModel
lf.detailsModel = [PolicyDetailsModel mj_objectWithKeyValues:data];
---BUtton上图下字
_tHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
社区宣传[_rviceButton tTitleEdgeInts:UIEdgeIntsMake(_rviceButton.imageView.frame.size.height+vnum ,-_rviceButton.imageView.frame.size.width, 0.0,0.0)]; [_rviceButton tImageEdgeInts:UIEdgeIntsMake(-vnum, 0.0,0.0, -_rviceButton.titleLabel.bounds.size.width)];
---Buttton左字右图
[_timebutton tTitle:@"全部时间" forState:UIControlStateNormal];
[_timebutton tImage:[UIImage imageNamed:@"market_2"] forState:UIControlStateNormal];
[_timebutton tTitleEdgeInts:UIEdgeIntsMake(0, -
_timebutton.imageView.frame.size.width, 0, _timebutton.imageView.frame.size.width)];
[_timebutton tImageEdgeInts:UIEdgeIntsMake(0, _timebutton.titleLabel.bounds.size.width, 0, - _timebutton.titleLabel.bounds.size.width)];
---CButton
UIButton * cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
cancelButton.frame = CGRectMake(100, 100, 100, 100);
[cancelButton tTitle:@"保存" forState:UIControlStateNormal];
[cancelButton.titleLabel tFont:[UIFont systemFontOfSize:14]];
[cancelButton tTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[cancelButton addTarget:lf action:@lector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
[lf.view addSubview:cancelButton];
---CellBlock
@property (nonatomic, copy) void (^lectCallBack) (NSInteger index);
---CGFloat nameH
CGFloat nameH =[lf.partLabel getSpaceLabelHeight:_ withWidh:SCREEN_WIDTH-50-90 font:13];
---CGSize titlesize
CGSize titlesize = [_ sizeWithAttributes:@{NSFontAttributeName: SMALLFONT}];
---CreateTableView
- (UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
_wHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 70;//这句必须写上值可以为⾃⼰估算的cell的⾼
_tableView.delegate = lf;
_tableView.dataSource = lf;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.estimatedRowHeight = 60;
_tableView.estimatedSectionHeaderHeight = 0;
_tableView.estimatedSectionFooterHeight = 0;
_tableView.tableHeaderView = lf.headerView;
_tableView.paratorStyle = UITableViewCellSeparatorStyleNone;
[_tableView registerNib:[UINib nibWithNibName:@"GreenRunRoundCell" bundle:nil] forCellReuIdentifier:@"GreenRunRoundCell"];
[_tableView registerNib:[UINib nibWithNibName:@"PolicyCommentsCell" bundle:nil] forCellReuIdentifier:@"PolicyCommentsCell"];
[_tableView registerNib:[UINib nibWithNibName:@"HomeListHeaderView" bundle:nil] forHeaderFoot
erViewReuIdentifier:@"HomeListHeaderView"];
}
return _tableView;
}
---CreateXibCell
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
爱我自己{
static NSString *identifer = @"LifeCardCell";//这⾥的cellID就是cell的xib对应的名称
LifeCardCell *cell = (LifeCardCell *)[tableView dequeueReusableCellWithIdentifier:identifer];
if(nil == cell) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:identifer owner:lf options:nil];
cell = [nib objectAtIndex:0];
}

本文发布于:2023-07-08 07:49:30,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1085079.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

下一篇:VBA
标签:点击   指定   侧滑   协议
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图