设为首页 加入收藏

TOP

【代码笔记】iOS-iCarouselDemo(二)
2017-10-13 10:24:16 】 浏览:3907
Tags:代码 笔记 iOS-iCarouselDemo
UIButton buttonWithType:UIButtonTypeCustom]; back.frame = CGRectMake(10, 10, 25, 31); [back setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal]; [back addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; [tableView addSubview:back]; } #pragma -mark -doClickActions -(void)back { CATransition *animation = [CATransition animation]; animation.delegate = self; animation.duration = 0.7; animation.type = @"oglFlip"; animation.subtype = kCATransitionFromLeft; [self.view.layer addAnimation:animation forKey:@"animation"]; [self.navigationController dismissViewControllerAnimated:YES completion:nil]; } #pragma -mark -UITableViewDelegate -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return array.count; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSString * str = [array objectAtIndex:indexPath.row]; CGSize size=[str boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:20.0]} context:nil].size; if(indexPath.row == 0) { return size.height + 350; } else { return size.height + 60; } } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { myCell * cell = [tableView dequeueReusableCellWithIdentifier:@"id"]; if(cell == nil){ cell = [[myCell alloc] initWithStyle:UITableViewCellStyleva lue1 reuseIdentifier:@"id"]; } NSString * str = [array objectAtIndex:indexPath.row]; CGSize size=[str boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:20.0]} context:nil].size; cell.selectionStyle = UITableViewCellSelectionStyleNone; NSString * str2 = [NSString stringWithFormat:@" %@ ",[titleArray objectAtIndex:indexPath.row]]; CGSize size2=[str boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:10.0]} context:nil].size; cell.title.text = str2; if(indexPath.row == 0){ cell.myImageView.hidden = NO; cell.myImageView.image = [UIImage imageNamed:imageName]; cell.myImageView.frame = CGRectMake(0, 0, 320, 300); cell.myLabel.frame = CGRectMake(10, 350, 300, size.height); cell.title.frame = CGRectMake(10, 310, size2.width, 30); }else{ cell.myImageView.hidden = YES; cell.myLabel.frame = CGRectMake(10, 50, 300, size.height); cell.title.frame = CGRectMake(10, 10,size2.width, 30); } cell.myLabel.text = str; return cell; } @end
复制代码
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇iOS9弹框的最新两种方式(解决控.. 下一篇【Swift学习】Swift编程之旅---闭..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目