CGRect rect = CGRectMake(0, 0, 100, 50); CGSize radio = CGSizeMake(5, 5);//圆角尺寸 UIRectCorner corner = UIRectCornerTopLeft|UIRectCornerTopRight;//这只圆角位置 UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corner cornerRadii:radio]; CAShapeLayer *masklayer = [[CAShapeLayer alloc]init];//创建shapelayer masklayer.frame = button.bounds; masklayer.path = path.CGPath;//设置路径 button.layer.mask = masklayer;
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; //给navigationBar设置一个空的背景图片即可实现透明,而且标题按钮都在
self.navigationController.navigationBar.shadowImage = [UIImage new]; //其实这个线也是image控制的。设为空即可
//navigationBar是一个复合视图,它是有许多个控件组成的,那么我们就可以从他的内部入手 [[self.navigationController.navigationBar subviews] objectAtIndex:0].alpha = 0; //这里可以根据scrollView的偏移量来设置alpha就实现了渐变透明的效果
//UIColorWithHexRGB( )这个方法是自己定义的,这里只需要给个颜色就好了
[[UINavigationBar appearance] setBarTintColor:UIColorWithHexRGB(0xfefefe)];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFontboldSystemFontOfSize:18],NSForegroundColorAttributeName:UIColorWithHexRGB(0xfe6d27)}];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFontboldSystemFontOfSize:10],NSForegroundColorAttributeName : UIColorWithHexRGB(0x666666)}forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSiz
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
//需要遵循一下手势的代理
self.navigationController.interactivePopGestureRecognizer.delegate = self;
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
UIView *webBrowserView = self.webView.scrollView.subviews[0];//拿到webView的webBrowserView self.backHeadImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth,kScreenWidth*2/3.0)]; [_backHeadImageView sd_setImageWithURL:[NSURL URLWithString:self.imageUrl] placeholderImage:[UIImageimageNamed:@"placeholderImage"]]; [self.webView insertSubview:_backHeadImageView belowSubview:self.webView.scrollView]; //把backHeadImageView插入到webView的scrollView下面 CGRect frame = self.webBrowserView.frame; frame.origin.y = CGRectGetMaxY(_backHeadImageView.frame); self.webBrowserView.frame = frame; //更改webBrowserView的frame向下移backHeadImageView的高度,使其可见
DetailViewController *detailVC = [[DetailViewController alloc]init]; //UIModalTransitionStyleFlipHorizontal 翻转 //UIModalTransitionStyleCoverVertical 底部滑出 //UIModalTransitionStyleCrossDissolve 渐显 //UIModalTransitionStylePartialCurl 翻页 detailVC.modalTransitionStyle = UIModalTransitionStylePartialCurl; [self presentViewController:detailVC animated:YES completion:nil];
UIImage *image = [UIImage imageNamed:filename]; CGImageRef imageRef = image.CGImage; CGRect rect = CGRectMake(origin.x, origin.y ,size.width, size.height); //这里的宽高是相对于图片的真实大小 //比如你的图片是400x400的那么(0,0,400,400)就是图片的全尺寸,想取哪一部分就设置相应坐标即可 CGImageRef imageRefRect = CGImageCreateWithImageInRect(imageRef, rect); UIImage *imageRect = [[UIImage alloc] initWithCGImage:imageRefRect];
UIImage *image = [UIImage imageNamed:@"playing"]; _layerView.layer.contents = (__bridge id)image.CGImage; _layerView.layer.contentsCenter = CGRectMake(0.25, 0.25, 0.5, 0.5); //同样可以设置显示的图片范围 //不过此处略有不同,这里的四个值均为0-1之间;对应的依然是写x,y,widt,height
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath{
NSArray *array = tableView.indexPathsForVisibleRows;
NSIndexPath *firstIndexPath = array[0];
//设置anchorPoint
cell.layer.anchorPoint = CGPointMake(0, 0.5);
//为了防止cell视图移动,重新把cell放回原来的位置
cell.layer.position = CGPointMake(0, cell.layer.position.y);
//设置cell 按照z轴旋转90度,注意是弧度
if (firstIndexPath.row < indexPath.row) {
cell.layer.transform = CATransform3DMakeRotation(M_PI_2, 0, 0, 1.0);
}else{
cell.layer.transform = CATransform3DMakeRotation(- M_PI_2, 0, 0, 1.0);
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有