- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- (void)setCategory:(NSDictionary *)newCategory
{
id category = [newCategory retain];
[_category release];
_category = category;
if(_category != nil) {
NSString *categoryID = GetString([_category objectForKey:@"id"]);
const CategoryViewData *data = FindCategoryViewData(categoryID);
if(data == NULL)
goto _clearView;
UIImage *buttonImage = [UIImage imageNamed:GetCategoryIconName(categoryID)];
[_titleButton setImage:buttonImage forState:UIControlStateNormal];
NSString *buttonTitle = [NSString stringWithFormat:@" %@ ➤", data->buttonTitle];
[_titleButton setTitle:buttonTitle forState:UIControlStateNormal];
UIImage *buttonColorImage = [UIImage imageNamed:buttonColorImageName];
[_titleButton setTitleColor:[UIColor colorWithPatternImage:buttonColorImage] forState:UIControlStateNormal];
_pageControl.onImage = [UIImage imageNamed:data->pageControlOnImageName];
_pageControl.currentPage = 0;
_pageControl.numberOfPages = numberOfPages;
_allVideosLabel.text = [NSString stringWithFormat:@"Все %@", data->allVideosTitle];
[self adjustVideoViews];
}
else {
_clearView:
[_titleButton setImage:nil forState:UIControlStateNormal];
[_titleButton setTitle:nil forState:UIControlStateNormal];
[_titleButton setTitleColor:nil forState:UIControlStateNormal];
_pageControl.onImage = nil;
_pageControl.currentPage = 0;
_pageControl.numberOfPages = 0;
_allVideosLabel.text = nil;
for(CategoryRowCell *cell in _videoViews) {
[cell removeFromSuperview];
}
self.videoViews = nil;
_scrollView.contentSize = CGSizeZero;
_scrollView.contentOffset = CGPointZero;
_allVideosView.frame = CGRectMake(0, 0, CGRectGetWidth(_allVideosView.frame), CGRectGetHeight(_allVideosView.frame));
_allVideosView.hidden = YES;
}
}
tirinox 03.06.2013 23:56 # 0
clockworkman 05.06.2013 17:19 # 0