项目介绍:
简单的SDAutolayout适配加上自定义按钮以及简单的自定义弹框
[Objective-C] 查看源文件 复制代码
-(void)loadData{
self.arrayModel = [[NSMutableArray alloc]init];
arrayName = @[@"GSD_iOS",
@"风口上的猪",
@"当今世界网名都不好起了",
@"我叫郭德纲",
@"Hello Kitty"];
arrayContent = @[@"当你的 app 没有提供 3x 的 LaunchImage 时,系统默认进入兼容模式,大屏幕一切按照 320 宽度渲染,屏幕宽度返回 320;然后等比例拉伸到大屏。这种情况下对界面不会产生任何影响,等于把小屏完全拉伸。",
@"然后等比例拉伸到大屏。这种情况下对界面不会产生任何影响,等于把小屏完全拉伸。",
@"当你的 app 没有提供 3x 的 LaunchImage 时",
@"但是建议不要长期处于这种模式下,否则在大屏上会显得字大,内容少,容易遭到用户投诉。",
@"屏幕宽度返回 320;然后等比例拉伸到大屏。这种情况下对界面不会产生任何影响,等于把小屏完全拉伸。但是建议不要长期处于这种模式下。"
];
NSArray *images = @[@"1.jpg",@"2.jpg",@"3.jpg",@"4.jpg",@"5.jpg"];
NSArray *contentImages = @[@"11.jpg",@"12.jpg",@"13.jpg",@"14.jpg",@"15.jpg"];
for (int i = 0; i < arrayContent.count; i ++) {
Model *model = [[Model alloc]init];
model.name = arrayName;
model.content = arrayContent;
model.image = images;
model.contentImage = contentImages;
[self.arrayModel addObject:model];
}
[self.tableView reloadData];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.arrayModel.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *ID = @"test";
LiveTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
if (!cell) {
cell = [[LiveTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.model = self.arrayModel[indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
tan = [[TanKuangViewController alloc]initWithTitle];
tan.delegate =self;
[tan makeKeyAndVisible];
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return [self.tableView cellHeightForIndexPath:indexPath model:self.arrayModel[indexPath.row] keyPath:@"model" cellClass:[LiveTableViewCell class] contentViewWidth:[self cellContentViewWith]];
}
- (CGFloat)cellContentViewWith
{
CGFloat width = [UIScreen mainScreen].bounds.size.width;
// 适配ios7
if ([UIApplication sharedApplication].statusBarOrientation != UIInterfaceOrientationPortrait && [[UIDevice currentDevice].systemVersion floatValue] < 8) {
width = [UIScreen mainScreen].bounds.size.height;
}
return width;
}
DEMO 直接下载:

LiveLocal.zip
(1.59 MB, 下载次数: 90, 售价: 10 金钱)
2016-7-18 10:47 上传
点击文件名下载附件
