1、屏幕常亮 [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
退出程序时把自动休眠功能开启
[UIApplication sharedApplication].idleTimerDisabled=NO;
2、点击图片浏览大图 XWScanImage
3、关键字加点击事件 “查看详情” UILabel+YBAttributeTextTapAction
[cell.contentLabel yb_addAttributeTapActionWithStrings:@[@"[查看详情]"] tapClicked:^(NSString *string, NSRange range, NSInteger index) {
[self didSelectwhichCell:cell];
}];
4、添加侧滑返回
AllVideoViewController *videoVC = [[AllVideoViewController alloc]init];
[videoVC setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:videoVC animated:YES];
遵循UIGestureRecognizerDelegate
self.navigationController.interactivePopGestureRecognizer.delegate = self;
5、修改电池条颜色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];//修改电池条黑色
6、修改导航栏分割线
[self.navigationController.navigationBar setShadowImage:[UIImage imageNamed:@"Search_W bg Copy@2x"]];
7、颜色渐变
UIColor *colorOne = [UIColor colorWithRed:(0/255.0) green:(0/255.0) blue:(0/255.0) alpha:0.0];
UIColor *colorTwo = [UIColor colorWithRed:(0/255.0) green:(0/255.0) blue:(0/255.0) alpha:1.0];
NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, nil];
CAGradientLayer *gradient = [CAGradientLayer layer];
//设置开始和结束位置(设置渐变的方向)
gradient.startPoint = CGPointMake(0, 0);
gradient.endPoint = CGPointMake(0, 1);
gradient.colors = colors;
gradient.frame = CGRectMake(0, 0, SCREENH_HEIGHT, 56);
[self.btnView.layer insertSublayer:gradient atIndex:0];
8、设置阴影
whiteView.layer.masksToBounds = NO;
whiteView.layer.cornerRadius = 4.0;
// whiteView.layer.borderColor = [@"#333842" hexStringToColor].CGColor;
// whiteView.layer.borderWidth = 0.5;
whiteView.layer.shadowColor = [@"#333842" hexStringToColor].CGColor;//shadowColor阴影颜色
whiteView.layer.shadowOffset = CGSizeMake(0,4);//shadowOffset阴影偏移,x向右偏移4,y向下偏移4,默认(0, -3),这个跟shadowRadius配合使用
whiteView.layer.shadowOpacity = 0.1;//阴影透明度,默认0
whiteView.layer.shadowRadius = 10.0;//阴影半径,默认3
9、设置字间距
NSDictionary *lineDic = @{NSKernAttributeName:@1.f,NSFontAttributeName:[UIFont fontWithName:@"PingFang-SC-Medium" size:16]};//字间距
NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:dict[@"title"] attributes:lineDic];
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
// [paragraphStyle setLineSpacing:24];//行间距
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [dict[@"title"] length])];
[_titleLab setAttributedText:attributedString];
10、获取点击某个cell上的按钮
[cell.replyBtn addTarget:self action:@selector(replyThumpAction:event:) forControlEvents:UIControlEventTouchUpInside];//评论里回复的点赞
- (void)thumpAction:(UIButton *)btn event:(id)event{
NSSet *touches =[event allTouches];
UITouch *touch =[touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.MyTable];
NSIndexPath *idx= [self.MyTable indexPathForRowAtPoint:currentTouchPosition];
// NSInteger index = btn.tag - 1000;
CommentListObj *obj = self.dataArr[idx.row];
}
11、设置textField的占位字的字体和颜色
[_NewField setValue:[@"#CCCCCC" hexStringToColor] forKeyPath:@"_placeholderLabel.textColor"];
[_NewField setValue:[UIFont fontWithName:@"PingFangSC-Regular" size:15] forKeyPath:@"_placeholderLabel.font"];