NSArray *array3 =[responseObject objectForKey:@"recommends"];
NSMutableArray *a = [[NSMutableArray alloc]init];
for(int k =0;k<[array3 count];k++){
SGFocusImageItem *item = [[SGFocusImageItem alloc] initWithTitle:@"" imageUrl:@"http://pic28.nipic.com/20130401/10680939_140035693107_2.jpg" placeholderImage:[UIImage imageNamed:@"ad.png"] tag:k];
[a addObject:item];
}
SGFocusImageFrame *imageFrame = [[SGFocusImageFrame alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 180.0) delegate:self items:a];
[self.scrollView addSubview:imageFrame];
NSArray *array =[responseObject objectForKey:@"list"];
for(int i=0;i<[array count];i++){
//设置标题
//标题
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(5,230*i+(i*30)+15+180, 3,15)];
[view setBackgroundColor:RGB(28.0, 191.0, 98.0)];
[self.scrollView addSubview:view];
UILabel *btn = [[UILabel alloc] initWithFrame:CGRectMake(0,230*i+(i*30)+8+180, 320, 30)];
[btn setText:[NSString stringWithFormat:@" %@",[array[i] objectForKey:@"name"]]];
[btn setTextColor:[UIColor blackColor]];
[self.scrollView addSubview:btn];
NSArray *array2 =[array[i] objectForKey:@"content"];
for(int j=0;j<[array2 count];j++){
NSLog(@"-----===-->%@",array2[j]);
//一个Item (view.frame.origin.y+40)*j
MyButton *button = [[MyButton alloc]initWithFrame:CGRectMake(j%2==0?162:6, view.frame.origin.y+((ceil( j / 2)) * 115)+30, 150, 105)];
// [button setBackgroundColor:[UIColor redColor]];
button.titleLabel.textColor=[UIColor clearColor];
[button addTarget:self action:@selector(itemOnClick:) forControlEvents:UIControlEventTouchUpInside];
[button setObject:array2[j]];
//
UIImageView *imgBgView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 150, 80)];
// imgBgView.image = [UIImage imageNamed:@"video-pic2.png"];
[imgBgView setImageWithURL:[NSURL URLWithString:[array2[j] objectForKey:@"videoImage"]] placeholderImage:[UIImage imageNamed:@"video-pic2.png"]];
[button addSubview:imgBgView];
//
UILabel *headLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 60, 150, 20)];
[headLabel setBackgroundColor:[UIColor clearColor]];
[headLabel setBackgroundColor:RGBA(0.0, 0.0, 0.0,0.5f)];
[headLabel setText:[NSString stringWithFormat:@" %@",[array2[j] objectForKey:@"videoName"]]];
[headLabel setFont:[UIFont systemFontOfSize:14.0f]];
[headLabel setTextColor:[UIColor whiteColor]];
[button addSubview:headLabel];
//
//
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 83, 150, 20)];
label.text = [NSString stringWithFormat:@"%@",[array2[j] objectForKey:@"videoIntroduction"]];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentLeft;
label.font = [UIFont systemFontOfSize:14];
[button addSubview:label];
[_scrollView addSubview:button];
}
[self.scrollView setContentSize:CGSizeMake(320, (266.7*[array count])+180)];
}